/* eslint valid-jsdoc: "off" */ /** * @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 + '_1718796622177_8852'; // add your middleware config here config.middleware = []; config.mongoose = { client: { url: 'mongodb://127.0.0.1:27017/back', options: { // useNewUrlParser: true, // useUnifiedTopology: true } } } config.security = { csrf: { // 判断是否需要 ignore 的方法,请求上下文 context 作为第一个参数 // ignore: ctx => isInnerIp(ctx.ip), ignore: '/', }, }; config.cors = { // 任何地址都可以访问 origin: "*", // 指定地址才可以访问 // origin: 'http://localhost:8080', // allowMethods: 'GET,PUT,POST,DELETE', allowMethods: 'POST', // cookie跨域配置 credentials: true }; config.bodyParser = { formLimit: "100mb", jsonLimit: "100mb", textLimit: "100mb", } // add your user config here const userConfig = { // myAppName: 'egg', }; return { ...config, ...userConfig, }; };