I have NodeJS + Express app and I want to redirect to a POST API from a GET route. I have looked at various posts on SO but none of them seem to be doing what I want to achieve. When I try the code below, I get a 404 error because GET /link2 is not found. Is there a way to redirect to the POST route without using fetch/axios?
app.get('/link1', function(req, res) {
res.redirect('/link2')
}
app.post('/link2', function(req, res) {
res.render('index')
}