const http = require('http'); const server = http.createServer(async (req, res) => { res.writeHead(200, {'Content-Type': 'text/html'}); try { await new Promise(resolve => setTimeout(resolve, 1000)); // Простой HTML-код const htmlContent = ` simple_server

HTML

`; // Отправка HTML клиенту res.end(htmlContent); } catch (error) { console.error('Ошибка:', error.message); res.writeHead(500, {'Content-Type': 'text/plain'}); res.end('Internal Server Error'); } }); const port = 3000; server.listen(port, () => { console.log(`Server started on port ${port}`); });