Blame view

apps/guang/index.js 729 Bytes
ccbikai authored
1 2 3 4 5 6 7
/**
 * sub app guang
 * @author: Bi Kai<kai.bi@yoho.cn>
 * @date: 2016/05/09
 */

var express = require('express'),
姜枫 authored
8
    path = require('path');
ccbikai authored
9 10 11 12 13 14 15 16 17 18 19

var app = express();

// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root

app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});
姜枫 authored
20
app.use(global.yoho.hbs({
ccbikai authored
21 22 23
    extname: '.hbs',
    defaultLayout: 'layout',
    layoutsDir: doraemon,
姜枫 authored
24 25
    partialsDir: path.join(__dirname, './views/partial'),
    views: path.join(__dirname, 'views/action'),
姜枫 authored
26
    helpers: global.yoho.helpers
ccbikai authored
27 28 29 30 31 32
}));

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

module.exports = app;