import http from 'node:http'; const PORT = 50000; const server = http.createServer(onRequest); let isShuttingDown = false; process.on('SIGINT', shutdown); process.on('SIGTERM', shutdown); server.listen(PORT); console.log('Started server') console.log(`Listening on port ${PORT}`); function onRequest(_request, response) { response.setHeader('Content-Type', 'application/json'); response.end(JSON.stringify({})); } function onServerClose() { console.log('Server shutdown'); } function shutdown() { if (isShuttingDown) return; console.log('Shutting down server'); isShuttingDown = true; server.close(onServerClose); }