Prev-content

[Node.js] 1. 서버 만들기

류뚝딱 2017. 12. 28. 18:26

1.서버만들기


Node.js는 자체적으로 웹서버를 내장하고있다. 다른 서버들과 달리 간단한 코드 몇자로
서버를 가동 시킬 수 있다.


1.서버

작업 루트(c:/workspaces/nodejs/)폴더에 server.js 파일생성
const http = require('http'); // 서버를 만드는 모듈 불러옴
http.createServer((request, response) => { // 서버 만드는 메소드
  console.log('서버 시작!');
}).listen(8080);