Select Git revision
MainRouter.ts
MainRouter.ts 2.09 KiB
import ComponentRouter from "./ComponentRouter";
import ComponentInformationRouter from "./ComponentInformationRouter";
import GenericRouter from "./GenericRouter";
import { Connection } from "typeorm";
import VocabularyRouter from "./VocabularyRouter";
import ComponentRelationRouter from "./ComponentRelationRouter";
import TypeDefinitionRouter from "./TypeDefinitionRouter";
import MeasurementRouter from "./MeasurementRouter";
import ContextRouter from "./ContextRouter";
class MainRouter extends GenericRouter {
private componentRouter: ComponentRouter
private informationRouter: ComponentInformationRouter
private vocabRouter: VocabularyRouter
private relationRouter: ComponentRelationRouter
private typeDefinitionRouter: TypeDefinitionRouter
private measurementRouter: MeasurementRouter
private contextRouter: ContextRouter
constructor(connection: Connection) {
super(connection);
this.componentRouter = new ComponentRouter(this.connection);
this.informationRouter = new ComponentInformationRouter(this.connection);
this.vocabRouter = new VocabularyRouter(this.connection);
this.relationRouter = new ComponentRelationRouter(this.connection);
this.typeDefinitionRouter = new TypeDefinitionRouter(this.connection);
this.measurementRouter = new MeasurementRouter(this.connection);
this.contextRouter = new ContextRouter(this.connection);
this.setup();
}
setup(): void {
// Setup Sub-Routers/Endpoints here
this.expressRouter.use("/component", this.componentRouter.expressRouter);
this.expressRouter.use("/information", this.informationRouter.expressRouter);
this.expressRouter.use("/vocab", this.vocabRouter.expressRouter);
this.expressRouter.use("/relation", this.relationRouter.expressRouter);
this.expressRouter.use("/type", this.typeDefinitionRouter.expressRouter);
this.expressRouter.use("/measurement", this.measurementRouter.expressRouter);
this.expressRouter.use("/context", this.contextRouter.expressRouter);
}
}
export default MainRouter;