title: nodejs express regex/replace response
body: <p>When programming I use 'localhost'for local tests but in production I don't want to edit every file in a large project, I'm wondering if I can dynamically replace 'localhost' to servers ip '123.123.123.123' to save a ton of time. Here is some code that I've tried with no luck.</p>
  
  <pre><code>var app = require('express')();
  var http = require('http').Server(app);
  var express = require('express');
  app.use(modify);
  app.use(express.static('./files'));
  function modify(req, res, next){
    res._send = res.send
    res.send = function(a) {
      a = a.replace('a', 'b');
      return res._send(a);
    }
    next();
  }
  http.listen(process.env.port, function () {
          console.log('listening on *:' + process.env.port);
  });
  </code></pre>
  
  <p>I've also tried all of the other stack overflow posts with similar topics with no luck, any help would be greatly appropriated. </p>