diff options
| author | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-22 11:33:52 +0000 |
|---|---|---|
| committer | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-22 11:33:52 +0000 |
| commit | 90fe02430c828b0d99d5f60c3073c54278d85236 (patch) | |
| tree | 1ec8feeb9e8ed3ceea9a8a34652ccc9bea4c7de4 /app.js | |
| parent | 7d492571ff92dc5b5ac963ab156d27ef5b51f782 (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.js | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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; |
