- var http = require('http');
- http.createServer(function(req, res) {
- res.writeHead(200, {'content-type' : 'text/plain'});
- res.end('Hello, World\n');
- }).listen(8124);
- console.log('Server running on 8124');
실행 법
node helloworld.js
웹 서버가 생성되고 실행이 됩니다.
로컬에 생성한 것으로 가정하여 접근 법은
http://127.0.0.1:8124 로 접근하면 됩니다. (8124 포트로 생성 했으므로)
'Dev Web > Node.js' 카테고리의 다른 글
[Node.js] express 모듈 (0) | 2013.09.24 |
---|---|
[Node.js] jade 외부 모듈 (0) | 2013.09.24 |
[Node.js] ejs 외부 모듈 (0) | 2013.09.24 |
[Node.js] 기본 내장 모듈 (0) | 2013.09.24 |
[Node.js] Node.js 개요. (0) | 2013.09.24 |