基于Koahub.js开发的cms后台管理系统
发布于 7 年前 作者 einsqing 6907 次浏览 来自 分享

QQ20170317-181348.jpg QQ20170317-181352.jpg QQ20170317-181402.jpg

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

github地址:https://github.com/koahubjs/koahub-simple-cms

回到顶部