Created
December 18, 2012 22:01
-
-
Save brianwigfield/4332467 to your computer and use it in GitHub Desktop.
Express routes
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
routes = require('./routes').addRoutes(app, storage) |
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
fs = require 'fs' | |
exports.addRoutes = (app, storage) -> | |
fs.readdir __dirname + '/routes', (err, files) -> | |
throw err if err | |
files.forEach (file) -> | |
require('./routes/' + file.replace('.coffee','')).routes app, storage |
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
exports.routes = (app, storage) -> | |
app.get '/', (req, res) -> | |
loggedIn = req.session.authId? | |
res.render 'index', {userName: req.session.authId, loggedIn: loggedIn} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment