Commit 922765ab authored by 杨翌文's avatar 杨翌文

修改为正式环境的分支

parent 27630325
......@@ -39,4 +39,7 @@ mongoModels.forEach(function(model) {
global.mongodb = mongodb;
require('./config/express')(app, config);
app.listen(config.port);
\ No newline at end of file
app.listen(config.port);
process.on('uncaughtException', function(err){
console.log(err);
});
\ No newline at end of file
......@@ -27,7 +27,7 @@ module.exports = function(app, config) {
store: new redisStore({
host:config.sessionStore.host,
port:config.sessionStore.port,
prefix:'sandbox-session-',
prefix:'node-session-',
pass : config.sessionStore.password,
ttl: 86400
}),
......@@ -44,29 +44,29 @@ 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) {
// 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) {
if (!req.session.user && req.query.key && req.query.key === 'aiwanpai') {
req.session.user = {
ent_code: 100041
};
}
if (!req.session.openUser && req.query.key && req.query.key === 'aiwanpai') {
req.session.openUser = {
openId: '1111',
integral: '100',
exp: '100'
};
}
next(null);
});
// app.use(function(req, res, next) {
// if (!req.session.user && req.query.key && req.query.key === 'aiwanpai') {
// req.session.user = {
// ent_code: 100041
// };
// }
// if (!req.session.openUser && req.query.key && req.query.key === 'aiwanpai') {
// req.session.openUser = {
// openId: '1111',
// integral: '100',
// exp: '100'
// };
// }
// next(null);
// });
//设置创建用户中间件
......@@ -83,6 +83,10 @@ app.use('/v1/forum/*',forumUser.identifyUser());
next(err);
});
process.on('uncaughtException', function(err){
console.log(err);
});
// if (app.get('env') === 'development') {
// app.use(function(err, req, res, next) {
// res.json({
......
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