I'm running into a small issue with something I thought was possible.
I want to have two express routes, one GET
route /post-data
and one POST
route /post-recieve
.
The code would look something like this:
app.get('/post-data', (req, res, next) => {
//set url to '/post-recieve' and set body / headers
})
app.post('/post-recieve', (req, res, next) => {
return res.json(res.body)
})
Now, when you visit /post-data
you should be instantly redirected to /post-recieve
except if you look in the developer console you should see that the method for the document is POST
and not a normal GET
request.
Is this possible?
I know you can use a library like request
to make a HTTP post request to an endpoint, but I'm talking about actually sending the user to the page via a POST
request.