xrm
Version:
45 lines (44 loc) • 1.61 kB
JavaScript
var mongoose = require('mongoose' ),
MongoStore = require('connect-mongo');
module.exports = function(app,express,path) {
app.set('views', path + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.set('session-secret','sEcReT sAlT?k4s^dhf iwue98kjh231kjh43nfl');
app.use(express.compiler({ src: path + '/public', enable: ['sass'] }));
app.use(app.router);
app.use(express.static(path + '/public'));
process.on('uncaughtException', function (err) {
console.log('UN-Caught exception: ' + err);
console.log('UN-Caught stack:' + err.stack);
});
// DEVELOPMENT
app.configure('development', function() {
// change this to the database you want to connect to!
app.set('db-uri', 'mongodb://localhost/mvc-development');
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
// TEST
app.configure('test', function() {
app.set('db-uri', 'mongodb://localhost/xrm-production');
app.use(express.errorHandler({ dumpExceptions: false, showStack: false }));
});
// PRODUCTION
app.configure('production', function() {
app.set('db-uri', 'mongodb://localhost/xrm-production');
app.use(express.errorHandler({ dumpExceptions: true, showStack: false }));
});
app.use(express.session({
secret: app.set('session-secret'),
store: new MongoStore({ url: app.set('db-uri') })
}));
//mongoose.connect(app.set('db-uri'));
app.dynamicHelpers({
req: function(req){
return req;
}
});
return app;
}