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()
}
'자바' 카테고리의 다른 글
Node.js 강좌 자료] 유틸리티 모듈 (0) | 2017.11.12 |
---|---|
Node.js 강좌 자료] 전역 객체 (0) | 2017.11.12 |
Node.js 강좌 자료] application 구성 요소 (0) | 2017.11.12 |
Node.js 강좌 자료] 개발 도구 (0) | 2017.11.12 |
Node.js 강좌 자료] Package.json (0) | 2017.11.12 |