Eggjs解决跨域问题
1:先安装egg-cors插件
npm install egg-cors -g
或者
yarn add egg-cors
2:在config/plugin.ts开启egg-cors插件
const plugin: EggPlugin = {
// 其他的
cors: {
enable: true,
package: 'egg-cors'
}
// 其他的
};
3:在config/config.default.ts中进行配置
export def..
原创
2022-03-26 13:49:47 ·
1355 阅读 ·
2 评论