34 lines
764 B
TypeScript
34 lines
764 B
TypeScript
import { app } from "./app";
|
|
import { logger } from "./logger";
|
|
|
|
const port = app.get("port");
|
|
const host = app.get("host");
|
|
const server = app.listen(port);
|
|
|
|
app.listen(port).then(() => {
|
|
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);
|
|
});
|