자바
Node.js 강좌 자료] application 만들기
행복한짱짱이
2017. 11. 12. 10:07
Node.js 강좌 자료] application 만들기
Node.js 강좌 자료] application 만들기
실무개발자를위한 실무교육 전문교육센터학원
www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수
있습니다.
application 만들기
단계 1 :필요한 모듈 임포트
- const http = require('http')
단계 2 :서버 만들기
- const server = http createServer(handler)
- server.listen(8081)
단계3 :요청을 읽고 응답을 전송
- functin handler(req, res) {
console.log('url:',req.url
console.log('method:',req,method)
res.writeHead(200, {'Content-Type':'text/html'})
res.write('<h1>Hello, World!</h1>')
res.end()
}