I have a route that's doing a lot of processing to display a view, DB queries and parsing and that sort of thing.
I'd like to 're-use' the processing of that route that gets displayed in the view. Simply using a res.render of the view will not suffice.
I am having a hard time explaining exactly what I'm after - effectively I am trying to avoid duplicating code.
router.get('/edit/:id', function(req, res) {
..lots of processing...
res.render('pages/campaigns/edit-campaign', {
...vars for handlebars...
});
});
router.all('/add/confirmation', function(req, res) {
... i have the data i need here, but not the processing ...
res.render('pages/campaigns/edit-campaign-new', {
...vars...
});
});
via Ollie
No comments:
Post a Comment