먼저 Prototype을 활용한 서버 생성 소스 const http = require('http'); // 서버 생성 const server = http.createServer((req, res) => { // 요청에 대한 결과를 보낼 때 200일 경우 정상 작동 res.statusCode = 200 // 해당하는 데이터로 어떠한 것을 보냈는지 명시적으로 선언 res.setHeader('Content-type', 'text/html'); // html 문서를 리턴한다. // 종료 res.end('Hello World'); }) // 명시적으로 포트를 외부에서 받음 //const port = process.env.PORT // 테스트 화면을 띄우기 위해 임의의 포트 번호 작성 const port = 3000; server.listen(port, () => { console.log(`Server running at port ${port}`); }) // Prototy...
#
class
#
javascript
#
node
#
nodejs
#
prototype
#
노드
#
차이점
#
클래스
#
프로토타입