2023-07-29 21:50:42 +00:00
|
|
|
import { app } from "./app";
|
|
|
|
import { logger } from "./logger";
|
2023-07-29 18:10:00 +00:00
|
|
|
|
2023-07-29 21:50:42 +00:00
|
|
|
const port = app.get("port");
|
|
|
|
const host = app.get("host");
|
2023-07-30 07:27:00 +00:00
|
|
|
const server = app.listen(port);
|
2023-07-29 18:10:00 +00:00
|
|
|
|
|
|
|
app.listen(port).then(() => {
|
2023-07-30 07:27:00 +00:00
|
|
|
logger.info(`Walias app listening on http://${host}:${port}`);
|
|
|
|
});
|
|
|
|
|
|
|
|
process.on("SIGINT", () => {
|
|
|
|
logger.info("Received SIGINT signal. Shutting down gracefully.");
|
|
|
|
|
|
|
|
server.close(() => {
|
|
|
|
logger.info("HTTP server closed.");
|
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
process.on("SIGTERM", () => {
|
|
|
|
logger.info("Received SIGTERM signal. Shutting down gracefully.");
|
|
|
|
|
|
|
|
server.close(() => {
|
|
|
|
logger.info("HTTP server closed.");
|
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
process.on("unhandledRejection", (reason) => {
|
|
|
|
logger.error("Unhandled rejection", reason);
|
|
|
|
process.exit(1);
|
2023-07-29 21:50:42 +00:00
|
|
|
});
|