109
rated 0 times
[
116]
[
7]
/ answers: 1 / hits: 8373
/ 10 Years ago, thu, may 1, 2014, 12:00:00
In Node/express I have a POST
request that if it contains an id
I would like it to call the PUT
method instead. No redirect, just how to call the put method from the post method?
router.put('/:id', function(req, res) {
// code ...
});
router.post('/:id?', function(req, res) {
if (req.params.id) {
// call PUT method
}
});
I don't want to do a redirect, just make it as if it was part of the current request.
More From » node.js