instant-workstation/backend/workstations/workstations.js
2026-08-29 18:18:56 +03:00

30 lines
No EOL
651 B
JavaScript

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);
}