I am using mikeal's awesome request module for NodeJS. I also use it with express , where I proxy an API call to solve CORS problems for older browsers:
app.use(function(request, response, next) { var matches = request.url.match(/^\/API_ENDPOINT\/(.*)/), method = request.method.toLowerCase(), url; if (matches) { url = 'http://myapi.com' + matches[0]; return request.pipe(req[method](url)).pipe(response); } else { next(); } });
Is there a way to change the body before I answer the request response to express ?
source share