changed express config
This commit is contained in:
parent
c32fef4338
commit
534d3e2aee
|
@ -32,6 +32,11 @@ module.exports = function(db) {
|
||||||
// Initialize express app
|
// Initialize express app
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
|
// Globbing model files
|
||||||
|
config.getGlobbedFiles('./app/models/**/*.js').forEach(function(modelPath) {
|
||||||
|
require(path.resolve(modelPath));
|
||||||
|
});
|
||||||
|
|
||||||
// Setting application local variables
|
// Setting application local variables
|
||||||
app.locals.title = config.app.title;
|
app.locals.title = config.app.title;
|
||||||
app.locals.description = config.app.description;
|
app.locals.description = config.app.description;
|
||||||
|
@ -92,16 +97,6 @@ module.exports = function(db) {
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
app.use(methodOverride());
|
app.use(methodOverride());
|
||||||
|
|
||||||
// use passport session
|
|
||||||
app.use(passport.initialize());
|
|
||||||
app.use(passport.session());
|
|
||||||
|
|
||||||
// setup express-device
|
|
||||||
app.use(device.capture({ parseUserAgent: true }));
|
|
||||||
|
|
||||||
// connect flash for flash messages
|
|
||||||
app.use(flash());
|
|
||||||
|
|
||||||
// Use helmet to secure Express headers
|
// Use helmet to secure Express headers
|
||||||
app.use(helmet.xframe());
|
app.use(helmet.xframe());
|
||||||
app.use(helmet.xssFilter());
|
app.use(helmet.xssFilter());
|
||||||
|
@ -109,15 +104,6 @@ module.exports = function(db) {
|
||||||
app.use(helmet.ienoopen());
|
app.use(helmet.ienoopen());
|
||||||
app.disable('x-powered-by');
|
app.disable('x-powered-by');
|
||||||
|
|
||||||
// Globbing model files
|
|
||||||
config.getGlobbedFiles('./app/models/**/*.js').forEach(function(modelPath) {
|
|
||||||
require(path.resolve(modelPath));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Globbing routing files
|
|
||||||
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
|
|
||||||
require(path.resolve(routePath))(app);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Setting the app router and static folder
|
// Setting the app router and static folder
|
||||||
app.use('/', express.static(path.resolve('./public')));
|
app.use('/', express.static(path.resolve('./public')));
|
||||||
|
@ -139,6 +125,22 @@ module.exports = function(db) {
|
||||||
name: config.sessionName
|
name: config.sessionName
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// use passport session
|
||||||
|
app.use(passport.initialize());
|
||||||
|
app.use(passport.session());
|
||||||
|
|
||||||
|
// setup express-device
|
||||||
|
app.use(device.capture({ parseUserAgent: true }));
|
||||||
|
|
||||||
|
// connect flash for flash messages
|
||||||
|
app.use(flash());
|
||||||
|
|
||||||
|
// Globbing routing files
|
||||||
|
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
|
||||||
|
require(path.resolve(routePath))(app);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Add headers for Sentry
|
// Add headers for Sentry
|
||||||
/*
|
/*
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
|
|
19
package.json
19
package.json
|
@ -23,14 +23,10 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^1.4.2",
|
"async": "^1.4.2",
|
||||||
"balanced-match": "^0.2.1",
|
|
||||||
"body-parser": "~1.14.1",
|
"body-parser": "~1.14.1",
|
||||||
"bower": "~1.6.5",
|
"bower": "~1.6.5",
|
||||||
"brace-expansion": "^1.1.1",
|
|
||||||
"builtin-modules": "^1.1.0",
|
|
||||||
"chalk": "~1.1.1",
|
"chalk": "~1.1.1",
|
||||||
"compression": "~1.6.0",
|
"compression": "~1.6.0",
|
||||||
"concat-map": "0.0.1",
|
|
||||||
"connect-flash": "~0.1.1",
|
"connect-flash": "~0.1.1",
|
||||||
"connect-mongo": "~0.8.2",
|
"connect-mongo": "~0.8.2",
|
||||||
"consolidate": "~0.13.1",
|
"consolidate": "~0.13.1",
|
||||||
|
@ -41,10 +37,9 @@
|
||||||
"express-session": "~1.12.1",
|
"express-session": "~1.12.1",
|
||||||
"forever": "~0.15.1",
|
"forever": "~0.15.1",
|
||||||
"fs-extra": "~0.26.2",
|
"fs-extra": "~0.26.2",
|
||||||
"glob": "~5.0.15",
|
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.1",
|
||||||
"grunt-cli": "~0.1.13",
|
"grunt-cli": "~0.1.13",
|
||||||
"grunt-concurrent": "~2.1.0",
|
"grunt-concurrent": "~2.3.0",
|
||||||
"grunt-contrib-csslint": "~0.5.0",
|
"grunt-contrib-csslint": "~0.5.0",
|
||||||
"grunt-contrib-cssmin": "~0.14.0",
|
"grunt-contrib-cssmin": "~0.14.0",
|
||||||
"grunt-contrib-jshint": "~0.11.3",
|
"grunt-contrib-jshint": "~0.11.3",
|
||||||
|
@ -59,7 +54,6 @@
|
||||||
"grunt-nodemon": "~0.4.0",
|
"grunt-nodemon": "~0.4.0",
|
||||||
"helmet": "~0.14.0",
|
"helmet": "~0.14.0",
|
||||||
"jit-grunt": "^0.9.1",
|
"jit-grunt": "^0.9.1",
|
||||||
"libqp": "^1.1.0",
|
|
||||||
"lodash": "^2.4.1",
|
"lodash": "^2.4.1",
|
||||||
"main-bower-files": "~2.9.0",
|
"main-bower-files": "~2.9.0",
|
||||||
"math": "0.0.3",
|
"math": "0.0.3",
|
||||||
|
@ -68,9 +62,7 @@
|
||||||
"mongoose-utilities": "~0.1.1",
|
"mongoose-utilities": "~0.1.1",
|
||||||
"morgan": "~1.6.1",
|
"morgan": "~1.6.1",
|
||||||
"multer": "~1.1.0",
|
"multer": "~1.1.0",
|
||||||
"node-freegeoip": "0.0.1",
|
|
||||||
"nodemailer": "~1.10.0",
|
"nodemailer": "~1.10.0",
|
||||||
"nools": "^0.4.1",
|
|
||||||
"passport": "~0.3.0",
|
"passport": "~0.3.0",
|
||||||
"passport-facebook": "~2.0.0",
|
"passport-facebook": "~2.0.0",
|
||||||
"passport-github": "~1.0.0",
|
"passport-github": "~1.0.0",
|
||||||
|
@ -79,16 +71,9 @@
|
||||||
"passport-local": "~1.0.0",
|
"passport-local": "~1.0.0",
|
||||||
"passport-twitter": "~1.0.2",
|
"passport-twitter": "~1.0.2",
|
||||||
"pdffiller": "~0.1.1",
|
"pdffiller": "~0.1.1",
|
||||||
"pkg-up": "^1.0.0",
|
|
||||||
"raven": "^0.9.0",
|
"raven": "^0.9.0",
|
||||||
"repeating": "^2.0.0",
|
|
||||||
"request": "^2.60.0",
|
|
||||||
"request-promise": "^1.0.2",
|
|
||||||
"shortid": "^2.2.2",
|
|
||||||
"soap": "^0.11.0",
|
"soap": "^0.11.0",
|
||||||
"swig": "~1.4.1",
|
"swig": "~1.4.1"
|
||||||
"then-fs": "~2.0.0",
|
|
||||||
"useragent": "~2.1.7"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coveralls": "^2.11.4",
|
"coveralls": "^2.11.4",
|
||||||
|
|
Loading…
Reference in a new issue