Guest User

Untitled

a guest
Sep 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import * as Application from 'koa';
  2. import * as KoaRouter from 'koa-router';
  3. import { IRegistrableController } from './RegistrableController';
  4. import { injectable } from 'inversify';
  5.  
  6. @injectable()
  7. export abstract class AbstractRouterController implements IRegistrableController {
  8. public abstract prefix: string;
  9.  
  10. public abstract setup(router: KoaRouter);
  11.  
  12. public register(app: Application) {
  13. const router = new KoaRouter({ prefix: this.prefix });
  14.  
  15. this.setup(router);
  16.  
  17. app.use(router.routes());
  18. app.use(router.allowedMethods());
  19. }
  20. }
Add Comment
Please, Sign In to add comment