partey_workadventure/pusher/src/App.ts
Alexis Faizeau d1e8243c47
Zod EVERYWHERE (#2027)
* Zod EVERYWHERE

* Add no-unused-vars rule to eslint in front

* Add no-unused-vars rule to eslint in pusher

* Add no-unused-vars rule to eslint in back

* Remove unused PlayerTexture guards

* Fix data providing on room connection

Co-authored-by: Alexis Faizeau <a.faizeau@workadventu.re>
2022-04-12 14:21:19 +02:00

43 lines
1.5 KiB
TypeScript

// lib/app.ts
import { IoSocketController } from "./Controller/IoSocketController";
import { AuthenticateController } from "./Controller/AuthenticateController";
import { MapController } from "./Controller/MapController";
import { PrometheusController } from "./Controller/PrometheusController";
import { DebugController } from "./Controller/DebugController";
import { AdminController } from "./Controller/AdminController";
import { OpenIdProfileController } from "./Controller/OpenIdProfileController";
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";
class App {
public app: HyperExpress.compressors.TemplatedApp;
constructor() {
const webserver = new HyperExpress.Server();
this.app = webserver.uws_instance;
// 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);
}
}
}
export default new App().app;