2020-11-13 18:00:22 +01:00
|
|
|
// lib/app.ts
|
2021-06-24 10:09:10 +02:00
|
|
|
import { IoSocketController } from "./Controller/IoSocketController"; //TODO fix import by "_Controller/..."
|
|
|
|
import { AuthenticateController } from "./Controller/AuthenticateController"; //TODO fix import by "_Controller/..."
|
|
|
|
import { MapController } from "./Controller/MapController";
|
|
|
|
import { PrometheusController } from "./Controller/PrometheusController";
|
|
|
|
import { DebugController } from "./Controller/DebugController";
|
|
|
|
import { AdminController } from "./Controller/AdminController";
|
2021-11-12 20:48:26 +01:00
|
|
|
import { OpenIdProfileController } from "./Controller/OpenIdProfileController";
|
2022-03-11 17:02:58 +01:00
|
|
|
import { WokaListController } from "./Controller/WokaListController";
|
|
|
|
import { SwaggerController } from "./Controller/SwaggerController";
|
|
|
|
import HyperExpress from "hyper-express";
|
|
|
|
import { cors } from "./Middleware/Cors";
|
|
|
|
import { ENABLE_OPENAPI_ENDPOINT } from "./Enum/EnvironmentVariable";
|
2020-11-13 18:00:22 +01:00
|
|
|
|
|
|
|
class App {
|
2022-03-11 17:02:58 +01:00
|
|
|
public app: HyperExpress.compressors.TemplatedApp;
|
2020-11-13 18:00:22 +01:00
|
|
|
|
|
|
|
constructor() {
|
2022-03-11 17:02:58 +01:00
|
|
|
const webserver = new HyperExpress.Server();
|
|
|
|
this.app = webserver.uws_instance;
|
2020-11-13 18:00:22 +01:00
|
|
|
|
2022-03-11 17:02:58 +01:00
|
|
|
// Global middlewares
|
|
|
|
webserver.use(cors);
|
|
|
|
|
|
|
|
// Socket controllers
|
|
|
|
new IoSocketController(this.app);
|
|
|
|
|
|
|
|
// Http controllers
|
|
|
|
new AuthenticateController(webserver);
|
|
|
|
new MapController(webserver);
|
|
|
|
new PrometheusController(webserver);
|
|
|
|
new DebugController(webserver);
|
|
|
|
new AdminController(webserver);
|
|
|
|
new OpenIdProfileController(webserver);
|
|
|
|
new WokaListController(webserver);
|
|
|
|
if (ENABLE_OPENAPI_ENDPOINT) {
|
|
|
|
new SwaggerController(webserver);
|
|
|
|
}
|
2020-11-13 18:00:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new App().app;
|