Workstations Service
This commit is contained in:
parent
9a2bd2bffd
commit
ed13bec66f
6 changed files with 92 additions and 1 deletions
30
backend/workstations/workstations.js
Normal file
30
backend/workstations/workstations.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue