Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop
Showing
4 changed files
with
70 additions
and
0 deletions
apps/home/controllers/index.js
0 → 100644
1 | +/** | ||
2 | + * 主页 | ||
3 | + * @author: Bi Kai<kai.bi@yoho.cn> | ||
4 | + * @date: 2016/05/09 | ||
5 | + */ | ||
6 | +'use strict'; | ||
7 | +const _ = require('lodash'); | ||
8 | +const helpers = global.yoho.helpers; | ||
9 | + | ||
10 | +/** | ||
11 | + * 频道选择页 | ||
12 | + */ | ||
13 | +const component = { | ||
14 | + index: (req, res, next) => { | ||
15 | + res.render('index', { | ||
16 | + module: 'example', | ||
17 | + page: 'home' | ||
18 | + }); | ||
19 | + } | ||
20 | +}; | ||
21 | + | ||
22 | +module.exports = component; |
apps/home/index.js
0 → 100644
1 | +/** | ||
2 | + * sub app home | ||
3 | + * @author: shenzm<zhimin.shen@yoho.cn> | ||
4 | + * @date: 2016/07/18 | ||
5 | + */ | ||
6 | + | ||
7 | +var express = require('express'), | ||
8 | + path = require('path'), | ||
9 | + hbs = require('express-handlebars'); | ||
10 | + | ||
11 | +var app = express(); | ||
12 | + | ||
13 | +// set view engin | ||
14 | +var doraemon = path.join(__dirname, '../../doraemon/views'); //parent view root | ||
15 | + | ||
16 | +app.on('mount', function(parent) { | ||
17 | + delete parent.locals.settings; // 不继承父 App 的设置 | ||
18 | + Object.assign(app.locals, parent.locals); | ||
19 | +}); | ||
20 | + | ||
21 | +app.set('views', path.join(__dirname, 'views/action')); | ||
22 | +app.engine('.hbs', hbs({ | ||
23 | + extname: '.hbs', | ||
24 | + defaultLayout: 'layout', | ||
25 | + layoutsDir: doraemon, | ||
26 | + partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | ||
27 | + helpers: global.yoho.helpers | ||
28 | +})); | ||
29 | + | ||
30 | +// router | ||
31 | +app.use(require('./router')); | ||
32 | + | ||
33 | +module.exports = app; |
apps/home/router.js
0 → 100644
apps/home/views/action/index.hbs
0 → 100644
1 | +<h1>test</h1> |
-
Please register or login to post a comment