// Мини-сервер для стенда: отдаёт файлы приложения, /healthz отвечает 200. Слушает $PORT. const http = require('node:http'); const fs = require('node:fs'); const path = require('node:path'); const FILES = { '/': ['index.html', 'text/html; charset=utf-8'], '/index.html': ['index.html', 'text/html; charset=utf-8'], '/manifest.webmanifest': ['manifest.webmanifest', 'application/manifest+json'], '/sw.js': ['sw.js', 'text/javascript; charset=utf-8'], '/icon.svg': ['icon.svg', 'image/svg+xml'] }; http.createServer((req, res) => { const url = (req.url || '/').split('?')[0]; if (url === '/healthz') { res.writeHead(200, { 'content-type': 'text/plain' }); return res.end('ok'); } const f = FILES[url]; if (!f) { res.writeHead(404); return res.end('not found'); } fs.readFile(path.join(__dirname, f[0]), (err, buf) => { if (err) { res.writeHead(500); return res.end('error'); } res.writeHead(200, { 'content-type': f[1], 'cache-control': 'no-cache' }); res.end(buf); }); }).listen(Number(process.env.PORT) || 3000, '0.0.0.0');