1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /* eslint valid-jsdoc: "off" */
- 'use strict';
- /**
- * @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 + '_1618984590142_9986';
- // add your middleware config here
- config.middleware = [];
- // 关闭安全防范
- config.security = {
- csrf: {
- enable: false,
- ignoreJSON: true,
- },
- };
- config.cors = {
- origin: '*',
- allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
- };
- // add your user config here
- const userConfig = {
- // myAppName: 'egg',
- };
- // 解除文件上传大小限制
- config.bodyParser = {
- jsonLimit: '100mb',
- formLimit: '100mb',
- };
- // jwt密钥
- config.jwt = {
- secret: '123456',
- };
- config.userSecret = '123456';
- // 数据库配置
- config.mongoose = {
- url: 'mongodb://127.0.0.1/example',
- options: {},
- };
- // 异常捕获
- config.middleware = [ 'errorHandler' ];
- config.errorHandler = {
- match: '/api',
- };
- return {
- ...config,
- ...userConfig,
- };
- };
|