Service decorators - oh the evil I have wraught....
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import Koa from "koa";
|
||||
import {DecoratedRouterCollector} from "../core/router";
|
||||
import {BaseService, service} from "../core/service";
|
||||
|
||||
@service('webserverService')
|
||||
export default class WebserverService extends BaseService {
|
||||
private app: Koa = new Koa();
|
||||
|
||||
add(router: any) {
|
||||
DecoratedRouterCollector.bindRouterToApp(router, this.app);
|
||||
}
|
||||
|
||||
listen(port: number = 8080) {
|
||||
this.app.listen(port);
|
||||
}
|
||||
|
||||
async init() {}
|
||||
async destroy() {}
|
||||
}
|
||||
Reference in New Issue
Block a user