Commit e5e81f9d by luyt

add: egg-core

1 parent 72cf3bbd
...@@ -17,5 +17,16 @@ module.exports = appInfo => { ...@@ -17,5 +17,16 @@ module.exports = appInfo => {
}, },
domainWhiteList: ["http://localhost:8080", "http://192.168.2.9:8080","*"] //允许访问接口的白名单 domainWhiteList: ["http://localhost:8080", "http://192.168.2.9:8080","*"] //允许访问接口的白名单
}; };
config.cors = {
// 任何地址都可以访问
origin:"*",
// 指定地址才可以访问
// origin: 'http://localhost:8080',
// allowMethods: 'GET,PUT,POST,DELETE',
allowMethods: '*',
// cookie跨域配置
credentials: true
};
return config return config
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,3 +2,7 @@ exports.sequelize = { ...@@ -2,3 +2,7 @@ exports.sequelize = {
enable: true, enable: true,
package: 'egg-sequelize', package: 'egg-sequelize',
}; };
exports.cors = {
enable: true,
package: 'egg-cors',
};
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"egg": "^2.30.0", "egg": "^2.30.0",
"egg-cors": "^2.2.3",
"egg-sequelize": "^5.2.1", "egg-sequelize": "^5.2.1",
"mysql2": "^2.3.0" "mysql2": "^2.3.0"
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!