I have configure app.js to redirect all request to my controller.js. The following is an example of how my controller.js looks like.
router.all('/Controller/:id', controller);
function controller(req, res){
//db check using the id mentioned in the url. And gets some values.
//Say it is stored in data variable.
var URL = "SOMEURL";
if(data != null){
if(data.METHOD == "POST"){
// needs to redirect as HTTP POST with URL.
}else{
res.redirect(URL);
}
}else{
console.log('No Data Found to redirect');
}
}
You can see that i need to redirect to a specific URL if the data.METHOD is POST. I tried res.redirect, but all it gives is a GET request. So How can i redirect as HTTP POST to a specific url? Please provide me a your ideas.
thanks and regards.