0

Нужен пример простейшего проекта, реализующего сервер на node JS.

1

1 ответ 1

1
const http = require('http');

http.createServer((req, res)=>{

// 1. Tell the browser everything is OK (Status code 200), and the data is in plain text.
res.writeHead(200, {
    'Content-Type': 'text/plain'
});

// 2. Send the announced text (the body of the page)
res.end('Hello, World!\n');

}).listen(1337);

А вот текст по первой ссылке, которая отвечает на вопрос, проще некуда, мне кажется.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.