From a8fc90f7a93832c981e109bfc2f015c2d77178e6 Mon Sep 17 00:00:00 2001 From: XadillaX Date: Mon, 30 Oct 2017 16:04:05 +0800 Subject: [PATCH] akyuu: move `init()` to constructor Fixes: https://github.com/akyuujs/akyuu/issues/37 --- example/demo/src/app.js | 5 ++++- lib/akyuu.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/demo/src/app.js b/example/demo/src/app.js index 62bd075..2d89ee2 100644 --- a/example/demo/src/app.js +++ b/example/demo/src/app.js @@ -6,9 +6,12 @@ */ "use strict"; +const path = require("path"); + const akyuu = require("../../../"); -akyuu.init(err => { +akyuu.setTemplateRoot(path.resolve(__dirname, "templates")); +akyuu.init(function(err) { if(err) { console.error("Failed to start akyuu.js"); console.error(err.stack); diff --git a/lib/akyuu.js b/lib/akyuu.js index bb29617..c426510 100644 --- a/lib/akyuu.js +++ b/lib/akyuu.js @@ -47,11 +47,12 @@ class Akyuu extends Express { this.controller = new Controller(this); this.service = new Service(this); this.boot = new Boot(this); + + super.init(); } init(callback) { const self = this; - super.init(); // load logger this.logger.load();