Created
August 9, 2012 13:26
-
-
Save iamdustan/3304168 to your computer and use it in GitHub Desktop.
Really ugly quick hack at route extending a componentized express app.
This file contains 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
var path = require('path'); | |
module.exports = function(app) { | |
app.get('/dashboard', app.user.loggedIn, function(req, res) { | |
return res.render(path.join(__dirname, 'home/dashboard'), { | |
user: req.session.user | |
}); | |
}); | |
app.get('/'), function(req, res) { | |
return res.render(path.join(app.viewsDir, 'home/index')); | |
}); | |
app.get('/blog', app.routes.include('blog.routes'); | |
}; |
This file contains 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
var path = require('path'); | |
module.exports = function(app) { | |
var routes = app.routes; | |
routes('/*', function(req, res) { | |
return res.render(path.join(app.viewsDir, 'blog/index')); | |
}); | |
app.get('/:slug'), function(req, res) { | |
return res.render(path.join(app.viewsDir, 'home/:slug')); | |
}); | |
// more routes | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment