목록2025/02/22 (1)
Will find a way

const http = require("http");// createServer 메서드가 생성한 서버를 변수나 상수로 지정해야함const server = http.createServer((req, res) => { const { url, method, headers } = req; console.log(url, method, headers); // 서버에 요청을 보내지 않으면 안됨 // res (response : 응답) 우리가 반송해야할 데이터 res.setHeader('Content-type', 'text/html'); // setHeader : 새로운 헤더 설정 / Content-type은 브라우저가 알고 이해하며 받아들이는 디폴트 헤더 // 응답에 헤더를 붙이게 되고, 컨텐츠 ..
BackEnd/NodeJs
2025. 2. 22. 15:54