2023-09-02 12:13:50 +00:00
|
|
|
import 'dotenv/config';
|
2023-09-14 16:53:03 +00:00
|
|
|
import './init';
|
2023-09-30 16:01:43 +00:00
|
|
|
import { initUdpServer } from './udp/server';
|
2023-10-03 11:47:17 +00:00
|
|
|
import { createServer } from 'http';
|
|
|
|
import { initSocketio } from './ws';
|
2023-10-04 17:56:33 +00:00
|
|
|
import { monitorManager } from './model/monitor';
|
2023-10-21 16:26:13 +00:00
|
|
|
import { env } from './utils/env';
|
2024-01-05 15:05:19 +00:00
|
|
|
import { initCronjob } from './cronjob';
|
2024-01-05 16:16:43 +00:00
|
|
|
import { logger } from './utils/logger';
|
2024-03-24 08:32:40 +00:00
|
|
|
import { app } from './app';
|
2023-09-02 17:01:55 +00:00
|
|
|
|
2024-01-13 10:16:09 +00:00
|
|
|
const port = env.port;
|
2023-08-31 13:17:57 +00:00
|
|
|
|
2023-10-03 11:47:17 +00:00
|
|
|
const httpServer = createServer(app);
|
2023-08-31 13:17:57 +00:00
|
|
|
|
2023-09-30 16:01:43 +00:00
|
|
|
initUdpServer(port);
|
|
|
|
|
2023-10-03 11:47:17 +00:00
|
|
|
initSocketio(httpServer);
|
2023-09-18 08:08:16 +00:00
|
|
|
|
2024-01-05 15:05:19 +00:00
|
|
|
initCronjob();
|
|
|
|
|
2023-10-04 17:56:33 +00:00
|
|
|
monitorManager.startAll();
|
|
|
|
|
2023-10-03 11:47:17 +00:00
|
|
|
httpServer.listen(port, () => {
|
2024-01-20 08:22:44 +00:00
|
|
|
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}`);
|
2023-08-31 13:17:57 +00:00
|
|
|
});
|