Commit 2bc95dfd authored by 张淼's avatar 张淼

1

parent c25c9535
...@@ -35,17 +35,26 @@ module.exports = function(app, config) { ...@@ -35,17 +35,26 @@ module.exports = function(app, config) {
} }
}); });
//添加中间件以支持跨域调用
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
res.header("Access-Control-Allow-Methods", "GET, PUT, POST");
res.header('Access-Control-Max-Age', 7200);
next();
});
app.use(function(req, res, next) { app.use(function(req, res, next) {
if (!req.session.user) { if (!req.session.user) {
req.session.user = { req.session.user = {
ent_code: 100001 ent_code: 100001
}; };
} }
if(!req.session.openUser){ if (!req.session.openUser) {
req.session.openUser={ req.session.openUser = {
openId:'54c9e321d5037010b44d4b1f', openId: '54c9e321d5037010b44d4b1f',
integral:'100', integral: '100',
exp:'100' exp: '100'
}; };
} }
next(null); next(null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment