const path = require('path');/*** @param {Egg.EggAppInfo} appInfo app info*/module.exports = appInfo => {/*** built-in config* @type {{security: {csrf: {headerName: string}}}}**/const config = exports = {security: {csrf: {enable: false,},},};// 验证规则config.validate = {convert: true,widelyUndefined: true,};// use for cookie sign key, should change to your own and keep securityconfig.keys = appInfo.name + '_1634002379446_8360';// add your middleware config hereconfig.middleware = ['authority', 'auth'];// add your user config hereconst userConfig = {// myAppName: 'egg',};config.cors = {origin: '*',allowMethods: 'GET, PUT, POST,DELETE, PATCH',};// config.io = {// init: {}, // passed to engine.io// namespace: {// '/': {// connectionMiddleware: ['auth'], // 这个是连接中间件, 只在connection的时候触发// packetMiddleware: ['auth'], // 这个会在每次消息的时候触发// }// },// }config.cluster = {listen: {path: '',port: 8001,hostname: '0.0.0.0',},};config.session = {key: 'EGG_SESS_TOKEN',maxAge: 1000 * 3600, // 1 天httpOnly: true,encrypt: true,};// 设置静态目录config.static = {prefix: '/public',dir: [path.join(appInfo.baseDir, 'app/public')],dynamic: true, // 如果当前访问的静态资源没有缓存,则缓存静态文件,和`preload`配合使用;preload: false,maxAge: 31536000, // in prod env, 0 in other envsbuffer: true, // in prod env, false in other envsmaxFiles: 1000,}config.multipart = {// 表单 Field 文件名长度限制fieldNameSize: 100,// 表单 Field 内容大小fieldSize: '100kb',// 表单 Field 最大个数fields: 10,// 单个文件大小fileSize: '10mb',// 允许上传的最大文件数files: 10,whitelist: ['.txt', '.png', '.jpeg', '.jpg', '.zip', '.xls', '.ppt', '.doc', '.docx', '.pdf', '.xls', '.xlsx', '.mp4', '.wmv', '.avi', '.mov', '.flv', '.rmvb'],};config.security = {csrf: {enable: false,ignoreJSON: true,},domainWhiteList: [],};config.cors = {origin: '*',allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',};const view = exports = {defaultViewEngine: 'nunjucks',mapping: {'.tpl': 'nunjucks',},};return {...config,...userConfig,...view,};};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。