projeto-hit/backend/src/server.ts

22 lines
630 B
TypeScript
Raw Normal View History

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";
const server = app.listen(process.env.PORT, () => {
logger.info(`Server started on port: ${process.env.PORT}`);
});
2023-01-07 19:35:25 +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`.');
}
initIO(server);
// StartAllWhatsAppsSessions();
gracefulShutdown(server);