Node js 스터디

 

2D - express router

  HTTPS Hypertext Transfer Protocol Over Secure Socket Layer

 * SSL 디지털 인증서

 

 * 공개키 방식 

       ex) private키로 암호화를 한 것을 public키로 복호화가 가능

const https = require('https');
const fs = require('fs');
const app = require('../app/index.js');

const dir = require('../app/api/v1/util/directory.path').dir;
const port = 3000;

const options = {
    key: fs.readFileSync(dir + '/key/ssl/private.pem', 'utf-8'),
    cert: fs.readFileSync(dir + '/key/ssl/public.pem', 'utf-8')
};

https.createServer(options, app).listen(port, () => {
    console.log('server start => port : ' + port);
});

  https 구현

 RESTFul

분산 하이퍼미디어 시스템을 위한 소프트웨어 아키텍처의 한 형식

- GET                         = index

- POST                       = create

- PUT or PATCH      = update

- DELETE                   = destory

  HTTP Header

Request Header

 - Accept

 - Accept-Charset

Response Header

 - Last-Modified

  http status code

success

 * 200 : OK

 * 201 : Create

 * 204 : Delete

 

error

  * 400 : Bad Request

  * 401 : Unauthorized

  * 403 : Forbidden (리소스 접근권한 만료)

  * 404 : Not Found

  * 405 : Method Not Allowed

 

  * 500 : Internal Server Error

Node js 스터디 D2

By attdro

Node js 스터디 D2

  • 583