changed express config
This commit is contained in:
parent
c32fef4338
commit
534d3e2aee
|
@ -31,6 +31,11 @@ var fs = require('fs-extra'),
|
|||
module.exports = function(db) {
|
||||
// Initialize express app
|
||||
var app = express();
|
||||
|
||||
// Globbing model files
|
||||
config.getGlobbedFiles('./app/models/**/*.js').forEach(function(modelPath) {
|
||||
require(path.resolve(modelPath));
|
||||
});
|
||||
|
||||
// Setting application local variables
|
||||
app.locals.title = config.app.title;
|
||||
|
@ -92,16 +97,6 @@ module.exports = function(db) {
|
|||
app.use(bodyParser.json());
|
||||
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
|
||||
app.use(helmet.xframe());
|
||||
app.use(helmet.xssFilter());
|
||||
|
@ -109,16 +104,7 @@ module.exports = function(db) {
|
|||
app.use(helmet.ienoopen());
|
||||
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
|
||||
app.use('/', express.static(path.resolve('./public')));
|
||||
app.use('/uploads', express.static(path.resolve('./uploads')));
|
||||
|
@ -138,7 +124,23 @@ module.exports = function(db) {
|
|||
cookie: config.sessionCookie,
|
||||
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
|
||||
/*
|
||||
app.use(function (req, res, next) {
|
||||
|
|
19
package.json
19
package.json
|
@ -23,14 +23,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"async": "^1.4.2",
|
||||
"balanced-match": "^0.2.1",
|
||||
"body-parser": "~1.14.1",
|
||||
"bower": "~1.6.5",
|
||||
"brace-expansion": "^1.1.1",
|
||||
"builtin-modules": "^1.1.0",
|
||||
"chalk": "~1.1.1",
|
||||
"compression": "~1.6.0",
|
||||
"concat-map": "0.0.1",
|
||||
"connect-flash": "~0.1.1",
|
||||
"connect-mongo": "~0.8.2",
|
||||
"consolidate": "~0.13.1",
|
||||
|
@ -41,10 +37,9 @@
|
|||
"express-session": "~1.12.1",
|
||||
"forever": "~0.15.1",
|
||||
"fs-extra": "~0.26.2",
|
||||
"glob": "~5.0.15",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-cli": "~0.1.13",
|
||||
"grunt-concurrent": "~2.1.0",
|
||||
"grunt-concurrent": "~2.3.0",
|
||||
"grunt-contrib-csslint": "~0.5.0",
|
||||
"grunt-contrib-cssmin": "~0.14.0",
|
||||
"grunt-contrib-jshint": "~0.11.3",
|
||||
|
@ -59,7 +54,6 @@
|
|||
"grunt-nodemon": "~0.4.0",
|
||||
"helmet": "~0.14.0",
|
||||
"jit-grunt": "^0.9.1",
|
||||
"libqp": "^1.1.0",
|
||||
"lodash": "^2.4.1",
|
||||
"main-bower-files": "~2.9.0",
|
||||
"math": "0.0.3",
|
||||
|
@ -68,9 +62,7 @@
|
|||
"mongoose-utilities": "~0.1.1",
|
||||
"morgan": "~1.6.1",
|
||||
"multer": "~1.1.0",
|
||||
"node-freegeoip": "0.0.1",
|
||||
"nodemailer": "~1.10.0",
|
||||
"nools": "^0.4.1",
|
||||
"passport": "~0.3.0",
|
||||
"passport-facebook": "~2.0.0",
|
||||
"passport-github": "~1.0.0",
|
||||
|
@ -79,16 +71,9 @@
|
|||
"passport-local": "~1.0.0",
|
||||
"passport-twitter": "~1.0.2",
|
||||
"pdffiller": "~0.1.1",
|
||||
"pkg-up": "^1.0.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",
|
||||
"swig": "~1.4.1",
|
||||
"then-fs": "~2.0.0",
|
||||
"useragent": "~2.1.7"
|
||||
"swig": "~1.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
|
|
Loading…
Reference in a new issue