index.js 476 Bytes
/**
 * sub app channel
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */

var express = require('express');

var app = express();

app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});

// for zookeeper, inject locals
app.use((req, res, next) => {
    req.app.locals.wap = app.locals.wap;

    next();
});

// router
app.use(require('./router'));

module.exports = app;