dev/Node

dev/Node

node js 에서 supervisor의 역할

코드를 변경할때마다 껏다 켰다 하는 번거로움이 있었다.저 슈퍼바이저가 코드가 변경되면 알아서 nodejs를 재실행 시켜준다.

dev/Node

아주 간단한 노드js 웹 어플리케이션

const http = require('http'); const hostname = '127.0.0.1';const port = 1337; http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n');}).listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`);});위의 코드는 node js의 가장 기본적인 웹서버를 구현할 수 있는 코드이다. http의 모듈을 가져와 http라는 변수에 저장하고 http는 createServer라는 메소드를 사용해 Se..

jeongsu
'dev/Node' 카테고리의 글 목록