Dev_Study/Node.js

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

LeeDaniel 2021. 4. 30. 09:45

1. 서버 생성

var http = require('http');

http.createServer(function (request, response) {
    response.writeHead(200, {'Content-Type': 'text/plain'});
    response.end('Hello World\n');
}).listen(8000);

console.log('Server running at http://localhost:8000/');

 

2. 서버 실행

node 파일명

Node.js 서버 실행

3. 테스트

정상 구동 확인

 

728x90
반응형