• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    해결됨

[기본 nodeJS 서버 만들기] res.send is not a function

23.11.04 10:48 작성 조회수 259

0

const http = require('http');

const host = 'localhost';
const port = 3000;

const server = http.createServer((req, res) => {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.send('<h1>Hello World</h1>');
});

server.listen(port, host, () => {
    console.log('Server running on http://localhost:3000...');
});
TypeError: res.send is not a function

이런 에러가 발생하는데 이유를 알 수 있을까요?

답변 1

답변을 작성해보세요.

0

안녕하세요!

강의 조금 더 진행 해보시면 res.end로 변경하는걸 볼 수 있습니다.

불편을드려 죄송합니다.

감사합니다!