import { Application, Router } from 'oak'; import { authenticateUser } from 'middleware/auth.ts'; type servicePrefix = `/${string}`; interface IServiceOpts { prefix: servicePrefix; } export class CGGService extends Application { public prefix: servicePrefix; constructor(options: IServiceOpts) { super(); this.prefix = options.prefix; this.use(authenticateUser); // this.baseRouter = new Router({prefix: this.prefix}); } start() { const port = Deno.args.at(0); this.listen({ port: port ? Number(port) : undefined }) } route(router: Router) { router.prefix(this.prefix); this.use(router.routes()) this.use(router.allowedMethods()); } }