fei.wang
2025-04-16 0b3d2deb37745ea5dce42fa4a18f22a29d2f4a12
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
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
 
export default (appInfo: EggAppInfo) => {
  const config = {} as PowerPartial<EggAppConfig>;
 
  // override config from framework / plugin
  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1596162922061_6405';
 
  // add your egg config in here
  config.middleware = [];
  //关闭post验证
  config.security = {
    csrf: {
      enable: false,
    }
  }
  //模板渲染
  config.view = {
    mapping: {
      '.html': 'nunjucks',
    }
  }
 
 
  // add your special config in here
  const bizConfig = {
    sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
  };
  // the return config will combines to EggAppConfig
  return {
    ...config,
    ...bizConfig
  };
};