tianji/src/server/main.ts
moonrailgun 50a35732ff feat: add zeromq to make sure lighthouse can only run one at same time
and add socketio notify to refresh list
2024-10-01 07:37:27 +08:00

34 lines
859 B
TypeScript

import 'dotenv/config';
import './init.js';
import { initUdpServer } from './udp/server.js';
import { createServer } from 'http';
import { initSocketio } from './ws/index.js';
import { monitorManager } from './model/monitor/index.js';
import { env } from './utils/env.js';
import { initCronjob } from './cronjob/index.js';
import { logger } from './utils/logger.js';
import { app } from './app.js';
import { runMQWorker } from './mq/worker.js';
const port = env.port;
const httpServer = createServer(app);
initUdpServer(port);
initSocketio(httpServer);
initCronjob();
runMQWorker();
monitorManager.startAll();
httpServer.listen(port, () => {
logger.info(`Server is listening on port ${port}...`);
if (env.allowOpenapi) {
logger.info(`Openapi UI: http://127.0.0.1:${port}/open/_ui`);
}
logger.info(`Website: http://127.0.0.1:${port}`);
});