Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as Application from 'koa';
- import * as KoaRouter from 'koa-router';
- import { IRegistrableController } from './RegistrableController';
- import { injectable } from 'inversify';
- @injectable()
- export abstract class AbstractRouterController implements IRegistrableController {
- public abstract prefix: string;
- public abstract setup(router: KoaRouter);
- public register(app: Application) {
- const router = new KoaRouter({ prefix: this.prefix });
- this.setup(router);
- app.use(router.routes());
- app.use(router.allowedMethods());
- }
- }
Add Comment
Please, Sign In to add comment