aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-22 11:33:52 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-22 11:33:52 +0000
commit90fe02430c828b0d99d5f60c3073c54278d85236 (patch)
tree1ec8feeb9e8ed3ceea9a8a34652ccc9bea4c7de4 /app.js
parent7d492571ff92dc5b5ac963ab156d27ef5b51f782 (diff)
Cleaned up the routing for users. Header changeable depending on whether user is logged in or not. Logout option.
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;