aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app.js b/app.js
index 8b469f9..a96a932 100644
--- a/app.js
+++ b/app.js
@@ -12,6 +12,7 @@ var passport = require('passport');
var flash = require('connect-flash');
var routes = require('./routes/index');
+var userRoutes = require('./routes/user');
var app = express();
// Templating engine, we are using handlebars
@@ -39,8 +40,17 @@ require('./config/passport'); // simply need to load it
/*LOADS ALL STATIC FILES FROM THE DIRECTORY __dirname*/
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
+ next();
+});
+
// Allows us to customize express routing
// in a separate file.
+app.use('/user', userRoutes);
app.use('/', routes);
module.exports = app;