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

修改为正式环境的分支

parent 27630325
...@@ -39,4 +39,7 @@ mongoModels.forEach(function(model) { ...@@ -39,4 +39,7 @@ mongoModels.forEach(function(model) {
global.mongodb = mongodb; global.mongodb = mongodb;
require('./config/express')(app, config); require('./config/express')(app, config);
app.listen(config.port); app.listen(config.port);
\ No newline at end of file process.on('uncaughtException', function(err){
console.log(err);
});
\ No newline at end of file
...@@ -27,7 +27,7 @@ module.exports = function(app, config) { ...@@ -27,7 +27,7 @@ module.exports = function(app, config) {
store: new redisStore({ store: new redisStore({
host:config.sessionStore.host, host:config.sessionStore.host,
port:config.sessionStore.port, port:config.sessionStore.port,
prefix:'sandbox-session-', prefix:'node-session-',
pass : config.sessionStore.password, pass : config.sessionStore.password,
ttl: 86400 ttl: 86400
}), }),
...@@ -44,29 +44,29 @@ module.exports = function(app, config) { ...@@ -44,29 +44,29 @@ module.exports = function(app, config) {
})); }));
//添加中间件以支持跨域调用 //添加中间件以支持跨域调用
app.use(function(req, res, next) { // app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); // 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-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
res.header("Access-Control-Allow-Methods", "GET, PUT, POST"); // res.header("Access-Control-Allow-Methods", "GET, PUT, POST");
res.header('Access-Control-Max-Age', 7200); // res.header('Access-Control-Max-Age', 7200);
next(); // next();
}); // });
app.use(function(req, res, next) { // app.use(function(req, res, next) {
if (!req.session.user && req.query.key && req.query.key === 'aiwanpai') { // if (!req.session.user && req.query.key && req.query.key === 'aiwanpai') {
req.session.user = { // req.session.user = {
ent_code: 100041 // ent_code: 100041
}; // };
} // }
if (!req.session.openUser && req.query.key && req.query.key === 'aiwanpai') { // if (!req.session.openUser && req.query.key && req.query.key === 'aiwanpai') {
req.session.openUser = { // req.session.openUser = {
openId: '1111', // openId: '1111',
integral: '100', // integral: '100',
exp: '100' // exp: '100'
}; // };
} // }
next(null); // next(null);
}); // });
//设置创建用户中间件 //设置创建用户中间件
...@@ -83,6 +83,10 @@ app.use('/v1/forum/*',forumUser.identifyUser()); ...@@ -83,6 +83,10 @@ app.use('/v1/forum/*',forumUser.identifyUser());
next(err); next(err);
}); });
process.on('uncaughtException', function(err){
console.log(err);
});
// if (app.get('env') === 'development') { // if (app.get('env') === 'development') {
// app.use(function(err, req, res, next) { // app.use(function(err, req, res, next) {
// res.json({ // 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