Skip to content

Instantly share code, notes, and snippets.

@iamdustan
Created August 9, 2012 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdustan/3304168 to your computer and use it in GitHub Desktop.
Save iamdustan/3304168 to your computer and use it in GitHub Desktop.
Really ugly quick hack at route extending a componentized express app.
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');
};
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