const http = require('http'); const fs = require('fs'); const path = require('path'); const PORT = process.env.PORT || 3000; const server = http.createServer((req, res) => { if (req.url === '/' || req.url === '/index.html') { const filePath = path.join(__dirname, 'index.html'); fs.readFile(filePath, (err, data) => { if (err) { res.writeHead(500); res.end('Error loading page'); return; } res.writeHead(200, { 'Content-Type': 'text/html' }); res.end(data); }); } else if (req.url === '/health') { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ status: 'ok' })); } else { res.writeHead(404); res.end('Not found'); } }); server.listen(PORT, () => { console.log(`Server running on http://localhost:${PORT}`); });