CORS 配置

安装 egg-cors

$ yarn add egg-cors

plugin.js

exports.cors = {
  enable: true,
  package: 'egg-cors',
};

config.default.js

config.security = {
  csrf: {
    enable: false
  }
};
config.cors = {
  origin:'*',
  allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
};

MIT Licensed | Copyright © 2018-present 滇ICP备16006294号

Design by Quanzaiyu | Power by VuePress