INNER CODE UNIT · TypeScript
exit
VityaSchel/lufin · backend/src/index.ts:58
const exit = async () => {
if (shuttingDown) return;
shuttingDown = true;
await Promise.all([closeStorage(), closeDb(), app.stop()]);
process.exit(0);
};
process.on("SIGINT", exit);
process.on("SIGTERM", exit);
app.listen(
{ port: process.env.PORT || 3000, hostname: process.env.HOST },
({ hostname, port }) => {
console.log(`Server is now listening on http://${hostname}:${port}`);
},
);