So, I am trying to get different data at different scenarios for the same URL. Here is my code.
1st scenario:
app.get('/upload', function(req, res) {
res.render('upload', {data: 'a'});
});
2nd scenario:
res.redirect('/upload');
app.get('/upload', function(req, res) {
res.render('upload', {data: 'b'});
});
However, for some reason, it always executes the 1st scenario (only passes data: 'a'). How to prioritize each of the get method for a specific situation?