Node.js HTTPS 모듈

❮ 내장 모듈


예시

컴퓨터의 포트 8080에서 수신 대기하는 https 서버를 만듭니다.

포트 8080에 액세스하면 "Hello World!"라고 작성하십시오. 응답으로 다시:

var https = require('https');

https.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.write('Hello World!');
  res.end();
}).listen(8080);

정의 및 사용

HTTPS 모듈은 Node.js가 보안 HTTP 프로토콜인 HTTP TLS/SSL 프로토콜을 통해 데이터를 전송하도록 하는 방법을 제공합니다.


통사론

애플리케이션에 HTTPS 모듈을 포함하기 위한 구문:

var https = require('https');

HTTPS 속성 및 메서드

Method Description
createServer() Creates an HTTPS server
get() Sets the method to GET, and returns an object containing the user's request
globalAgent Returns the HTTPS Agent
request Makes a request to a secure web server

❮ 내장 모듈