基于Koahub.js开发的cms后台管理系统
KoaHub.js – 中文最佳实践Node.js Web快速开发框架。支持Koa.js, Express.js中间件。
//base controller, admin/controller/base.controller.js
module.exports = class extends koahub.controller {
async _initialize() {
console.log('base _initialize');
}
async isLogin() {
console.log('base isLogin');
}
}
//index controller, admin/controller/index.controller.js
const base = require('./base.controller');
module.exports = class extends base {
async _initialize() {
await super._initialize();
}
async index() {
this.view(1);
}
async index2() {
this.json(1, 2);
}
async index3() {
await this.render('index');
}
}
环境要求:Node.js >= 7.6.0