let xhr = new XMLHttpRequest()
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.responseText)
}
}
xhr.open('get', 'http://127.0.0.1:7002')
xhr.send() config.cors = {
origin: '*',
allowMethods: 'GET,POST',
// 下面这条加上才能共享跨域session,同时前端ajax请求也要加上响应的参数
credentials: true,
};
config.security = {
// 关闭csrf验证
csrf: {
enable: false,
},
// 白名单
domainWhiteList: ['*'],
};
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
module.exports = {
// had enabled by egg
// static: {
// enable: true,
// }
cors: {
enable: true,
package: 'egg-cors',
},
};
//mysql8.0以上加密方式,Node还不支持。
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
//post
let query = this.ctx.request.body;
//get
let query = this.ctx.query;
后端笔记之eggjs的毕业设计了解
猜你喜欢
转载自blog.csdn.net/qq_45393395/article/details/120564671
今日推荐
周排行