Blame view

apps/channel/index.js 732 Bytes
biao authored
1 2 3 4 5 6 7
/**
 * sub app girls
 * @author: biao<bill.zhao@yoho.cn>
 * @date: 2016/05/16
 */

var express = require('express'),
周少峰 authored
8
    path = require('path');
biao authored
9 10 11 12 13 14

var app = express();

// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
biao authored
15
biao authored
16 17 18 19 20
app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});
周少峰 authored
21
app.use(global.yoho.hbs({
biao authored
22 23 24
    extname: '.hbs',
    defaultLayout: 'layout',
    layoutsDir: doraemon,
周少峰 authored
25 26
    partialsDir: [path.join(__dirname, 'views/partial')],
    views: path.join(__dirname, 'views/action'),
姜枫 authored
27
    helpers: global.yoho.helpers
biao authored
28 29 30 31 32 33
}));

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

module.exports = app;
34