333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';
 
const path = require('path');
 
module.exports = appInfo => ({
  /**
   * view default config
   * @member Config#view
   * @property {String} [root=${baseDir}/app/view] - give a path to find the file, you can specify multiple path with `,` delimiter
   * @property {Boolean} [cache=true] - whether cache the file's path
   * @property {String} [defaultExtension] - defaultExtension can be added automatically when there is no extension  when call `ctx.render`
   * @property {String} [defaultViewEngine] - set the default view engine if you don't want specify the viewEngine every request.
   * @property {Object} mapping - map the file extension to view engine, such as `{ '.ejs': 'ejs' }`
   */
  view: {
    root: path.join(appInfo.baseDir, 'app/view'),
    cache: true,
    defaultExtension: '.html',
    defaultViewEngine: '',
    mapping: {},
  },
});