POST (1) 썸네일형 리스트형 <노드JS> http 서버 만들기 1. http 서버 만들기 * 포트 연결 - http 요청에 응답하는 노드 서버를 만들어 보자. const http = require('http'); http.createServer((req, res) => { // 응답 내용 }); - 위와 같이 http를 불러와서 createServer로 서버를 만들 수 있다. - res로 응답을 보내는데 write로 응답내용을 적고, end로 끝을 낸다. // server1.js const http = require('http'); const server = http.createServer((req, res) => { res.writeHead(200, { 'content-Type': 'text/html; charset=utf-8' }); res.write('Hell.. 이전 1 다음