Blame view

apps/product/index.js 865 Bytes
张丽霞 authored
1 2 3 4 5
/**
 * sub app product
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2016/05/06
 */
张丽霞 authored
6
'use strict';
张丽霞 authored
7
姜枫 authored
8
var express = require('express'),
陈峰 authored
9 10
    path = require('path'),
    hbsEvent = require('../../config/hbsevent');
张丽霞 authored
11
姜枫 authored
12
var app = express();
张丽霞 authored
13
姜枫 authored
14 15
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
张丽霞 authored
16
姜枫 authored
17 18 19 20
app.on('mount', function(parent) {
    delete parent.locals.settings; // 不继承父 App 的设置
    Object.assign(app.locals, parent.locals);
});
张丽霞 authored
21
毕凯 authored
22 23
app.disable('x-powered-by');
姜枫 authored
24
app.use(global.yoho.hbs({
姜枫 authored
25 26 27
    extname: '.hbs',
    defaultLayout: 'layout',
    layoutsDir: doraemon,
陈轩 authored
28
    partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
姜枫 authored
29
    views: path.join(__dirname, 'views/action'),
陈峰 authored
30 31
    helpers: global.yoho.helpers,
    cb: hbsEvent.cb
姜枫 authored
32
}));
张丽霞 authored
33
姜枫 authored
34 35
// router
app.use(require('./router'));
ccbikai authored
36
姜枫 authored
37
module.exports = app;