2022-01-06 01:26:15 +00:00
|
|
|
import gracefulShutdown from "http-graceful-shutdown";
|
|
|
|
import app from "./app";
|
|
|
|
import { initIO } from "./libs/socket";
|
|
|
|
import { logger } from "./utils/logger";
|
|
|
|
import { StartAllWhatsAppsSessions } from "./services/WbotServices/StartAllWhatsAppsSessions";
|
2022-10-25 14:16:36 +00:00
|
|
|
|
2022-01-06 01:26:15 +00:00
|
|
|
const server = app.listen(process.env.PORT, () => {
|
|
|
|
logger.info(`Server started on port: ${process.env.PORT}`);
|
|
|
|
});
|
|
|
|
|
2022-12-31 06:12:26 +00:00
|
|
|
|
2023-01-02 00:24:50 +00:00
|
|
|
// if (global.gc) {
|
|
|
|
// console.log(">> Starting Garbage Collector...");
|
|
|
|
// global.gc();
|
|
|
|
// } else {
|
|
|
|
// console.warn('No GC hook! Start your program as `node --expose-gc file.js`.');
|
|
|
|
// }
|
2022-12-31 06:12:26 +00:00
|
|
|
|
2022-01-06 01:26:15 +00:00
|
|
|
initIO(server);
|
|
|
|
StartAllWhatsAppsSessions();
|
|
|
|
gracefulShutdown(server);
|