aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorHumairAK <humair88@hotmail.com>2016-07-27 06:44:05 +0000
committerHumairAK <humair88@hotmail.com>2016-07-27 06:44:05 +0000
commit6fd4613d0bf1bb78340e46d45b269ddd3c36f190 (patch)
tree91a2a795aa56d96d076acf1b202645d0e68dd47a /app.js
parent6271b9d13139c1e55118e5f26a3a7bf8caeeb11d (diff)
added compression
Diffstat (limited to 'app.js')
-rw-r--r--app.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/app.js b/app.js
index 10db51d..9832dcd 100644
--- a/app.js
+++ b/app.js
@@ -10,6 +10,7 @@ var expressValidator = require('express-validator');
var session = require('express-session');
var passport = require('passport');
var flash = require('connect-flash');
+var compression = require('compression');
var MongoStore = require('connect-mongo') (session); //for storing sessions in database
@@ -29,6 +30,8 @@ app.set('views', path.join(__dirname, 'views')); // Our view path
app.set('view engine', 'hbs');
// Middleware initialization, make sure everything is initialized in proper order
+app.use(compression());
+
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(expressValidator());
@@ -53,7 +56,6 @@ require('./config/passport'); // simply need to load it
app.use(express.static(__dirname));
// Needed to style the header based on the whether the user is signed in or not
-// Gives errors for admin - need to figure out
app.use(function(req, res, next) {
res.locals.login = req.isAuthenticated(); // global variable
res.locals.session = req.session;
@@ -62,6 +64,8 @@ app.use(function(req, res, next) {
next();
});
+
+
// Allows us to customize express routing
// in a separate file.
app.use('/admin', adminRoutes);
@@ -69,6 +73,7 @@ app.use('/user', userRoutes);
app.use('/', routes);
+/* Handle error page */
app.use(function(req, res, next){
res.status(404 || 500);