Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

基于Koahub.js开发的cms后台管理系统

$
0
0

QQ20170317-181348.jpgQQ20170317-181352.jpgQQ20170317-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


Viewing all articles
Browse latest Browse all 14821

Trending Articles