Last active
December 23, 2015 16:39
-
-
Save darrenderidder/6663354 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// module exports function that accepts an 'app' parameter | |
module.exports = function (app) { | |
// routes are attached to the app as usual | |
app.get("/dashboard", function (req, res) { | |
if (req.session.user) { | |
res.render('dashboard.ejs', {'title':'Dashboard'}); | |
} else { | |
res.redirect('/login'); | |
} | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main app.js example | |
// require route modules and pass in the app | |
var app = express(); | |
require('./routes/dashboard.js')(app); | |
require('./routes/portal.js')(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment