WE_USE_JS Telegram 4221
👩‍💻 Задачка по NodeJS

Напишите скрипт, который создаёт HTTP-сервер. При запросе на сервер он должен возвращать текст "Hello, World!".

Сервер запускается на порту 3000.
При обращении к http://localhost:3000 в браузере или через curl возвращается строка "Hello, World!".

Решение задачи ⬇️

const http = require('http');

const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello, World!');
});

server.listen(3000, () => {
console.log('Сервер запущен на http://localhost:3000');
});
Please open Telegram to view this post
VIEW IN TELEGRAM
👎6



tgoop.com/we_use_js/4221
Create:
Last Update:

👩‍💻 Задачка по NodeJS

Напишите скрипт, который создаёт HTTP-сервер. При запросе на сервер он должен возвращать текст "Hello, World!".

Сервер запускается на порту 3000.
При обращении к http://localhost:3000 в браузере или через curl возвращается строка "Hello, World!".

Решение задачи ⬇️

const http = require('http');

const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello, World!');
});

server.listen(3000, () => {
console.log('Сервер запущен на http://localhost:3000');
});

BY Node.JS [ru] | Серверный JavaScript


Share with your friend now:
tgoop.com/we_use_js/4221

View MORE
Open in Telegram


Telegram News

Date: |

Step-by-step tutorial on desktop: How to create a business channel on Telegram? (Tutorial) When choosing the right name for your Telegram channel, use the language of your target audience. The name must sum up the essence of your channel in 1-3 words. If you’re planning to expand your Telegram audience, it makes sense to incorporate keywords into your name. How to Create a Private or Public Channel on Telegram? Clear
from us


Telegram Node.JS [ru] | Серверный JavaScript
FROM American