eggs学习

发布时间 2023-03-22 21:17:16作者: 热心市民~菜先生

在egg中的上传是有两种方法来实现 File文件模式  Stream流模式 

1.https://dandelioncloud.cn/article/details/1570731575069601793 (eggs stream文件流上传)

2.https://blog.csdn.net/qq_31281245/article/details/127925008(Egg如何实现文件上传)

3.egg中设置跨域 (https://blog.csdn.net/weixin_44934525/article/details/109163033

1. 安装egg-cors
npm install egg-cors --save
1
2.配置plugin.js
'use strict';
/** @type Egg.EggPlugin */

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

3.配置config.default.js
config.security = {
csrf: {
enable: false,
},
domainWhiteList: [ '*' ],//允许访问接口的白名单,例如:http://localhost:8080 *表示均可访问
};

config.cors = {
origin: '*',
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
};

4.https://www.codenong.com/cs106369065/ (一文搞懂eggjs中上传文件)

5.https://www.cnblogs.com/xingguozhiming/p/12047952.html(egg 登录,权限管理学习)

 6.https://blog.csdn.net/qq_43363188/article/details/120675826(egg与TypeORM的框架整合)

7.https://blog.csdn.net/bbsyi/article/details/109180674(egg-sequelize使用教程)