config.default.js
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* eslint valid-jsdoc: "off" */
'use strict';
const path = require('path')
/**
* @param {Egg.EggAppInfo} appInfo app info
*/
module.exports = appInfo => {
/**
* built-in config
* @type {Egg.EggAppConfig}
**/
const config = exports = {};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1642067379356_9612';
// add your middleware config here
config.middleware = [];
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
const view = {
root: path.join(appInfo.baseDir, 'app/public'),
defaultViewEngine: 'nunjucks',
mapping: {
'.html': 'nunjucks',
}
}
config.cluster = {
listen: {
path: '',
port: 8001,
hostname: '0.0.0.0',
}
};
config.static = {
prefix: '',
dir: path.join(appInfo.baseDir, 'app/public'),
dynamic: true,//是否緩存靜態資源
preload: false,//啓動項目開啓緩存
maxAge: 0, //緩存時間 開發建議設0 跳坑
buffer: false//是否緩存到内存 默認prod 緩存
};
return {
...config,
...userConfig,
};
};