this is my routing setup:
app.get('*', getJSON);
app.get('/', [list, render]);
app.get('/questions', [list, render]);
app.get('/ask', [ask, render]);
app.get('/:questionId(\\d+)', [question, render]);
app.get('/:questionId(\\d+)/:slug', [question, render]);
app.get('/sitemap.xml', clone);
app.get('/feed/qa.rss', clone);
app.post('/rest/1/:object/:method', [post, render]);
app.all('*', function(req, res){
res.send(404).status('Page not found');
});
As you can see, almost all routes end up running a rendering function. I would like to apply the same template that I use at the beginning with getJSON, but at the end. An easy way to do this would be to add
app.all('*', render);
at the end, but I can’t because I want to skip sitemap.xml and qa.rss and all the paths not listed here, for example /foo.
How can I do that?
source
share