node.js - Edit response body with request and node -


I am trying to create a small proxy server that I can edit the request and response between the client and the server .

This is what I have so far received:

  var express = require ('express'); var app = express (); Var request = requirement ('request'); App.use ('/ login', function (rik, ridge) {var url = request.post ({Uuri: 'http://192.168.1.53', Jason: rake)}; recycle (url) .pip ( Ridge);}); app.listen (7501);   

This works perfectly for my situation, but I need to edit the request and response. That is, cookies come back and send data. Any help would be great. Very new for node

end with this - in the request with the expressway taken, then post request with a new created request And then there is some magic that gives the customer a second reaction back through express.

  app.usen ('/ login', function (rik, ridge) {request.post ('http://192.168.1.53', {form: {req: 'auth', Cid: '1', em: req.body.em, pw: req.body.pw, rm: true}}, function (error, feedback, body) {if (error and amp; feedback.stats code == 200) {var cookie = response.headers ['set-cookie']; console.log (cookie) console.log (body) // body-parser res.header usage ('access-control-permission-origin ',' * '); Res.header (' Access-Control-Allow-Headers', 'Access-Control-Allow-Headers',' Content-Type ',' Access-Control-App-Methods', 'GET, PUT, POST, DELETE'); '); Res.json ({success: true});}});});    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -