Get the response data from target server with express
Teenymario opened this issue · 0 comments
I have a node.js application that runs with express and with http-proxy.
Now the express server is where client requests come in and then the requests are forwarded to an internal php server
I have an endpoint that forwards requets to a php file called chatHandler.php which would respond with json data back to the client.
I would like to read the json response the internal server gives.
This is how the endpoint looks
app.post('/ChatHandler.php', (req, res, next) => { proxy.web(req, res, { target: 'http://localhost:8081/ChatHandler.php' }, next); });
Before the request is returned to the client I want to see what the response from "http:localhost:8081/ChatHandler.php" was, like the body of the response where the json data is.