2022-01-22 20:51:29 +01:00
|
|
|
import { config } from 'dotenv';
|
2022-01-22 22:37:59 +01:00
|
|
|
import Express from "express";
|
2022-01-22 20:51:29 +01:00
|
|
|
import Log75, { LogLevel } from 'log75';
|
|
|
|
|
|
|
|
config();
|
|
|
|
|
|
|
|
const PORT = Number(process.env.API_PORT || 9000);
|
|
|
|
const DEBUG = process.env.NODE_ENV != 'production';
|
|
|
|
|
|
|
|
const logger: Log75 = new (Log75 as any).default(DEBUG ? LogLevel.Debug : LogLevel.Standard);
|
|
|
|
const app = Express();
|
|
|
|
|
2022-01-22 22:37:59 +01:00
|
|
|
export { logger, app, PORT }
|
2022-01-22 20:51:29 +01:00
|
|
|
|
2022-01-22 22:37:59 +01:00
|
|
|
(async () => {
|
|
|
|
await Promise.all([
|
|
|
|
import('./middlewares/log'),
|
|
|
|
import('./routes/internal/ws'),
|
|
|
|
import('./routes/root'),
|
|
|
|
]);
|
|
|
|
logger.done('All routes and middlewares loaded');
|
|
|
|
})();
|
|
|
|
|
|
|
|
import('./server');
|