function configureExpress(config, done) {
  var portfinder = require('portfinder');

  tmp.dir(function(err, filepath){
    handles.filepath = filepath;

    portfinder.getPort(function (err, port) {
      if (err) throw(err);

      handles.port = port;

      fs.writeFileSync(path.join(handles.filepath, 'index.txt'), 'hello, world');

      app.use(proxy.initialize(config));
      app.use(express.static(handles.filepath));

      handles.server = require('http').createServer(app);
      handles.server.listen(handles.port, function() {
        done(null, handles.port);
      });
    });
  });
}
function configureExpress(config, done) {
  var portfinder = require('portfinder');

  tmp.dir(function(err, filepath){
    handles.filepath = filepath;

    portfinder.getPort(function (err, port) {
      if (err) throw(err);

      handles.port = port;

      fs.writeFileSync(path.join(handles.filepath, 'index.txt'), 'hello, world');

      app.use(proxy.initialize(config));
      app.use(express.static(handles.filepath));

      handles.server = require('http').createServer(app);
      handles.server.listen(handles.port, function() {
        done(null, handles.port);
      });
    });
  });
}
function configureExpress ( config , done ) { var portfinder = require ( 'portfinder' ) ; tmp . dir ( function ( err , filepath ) { handles . filepath = filepath ; portfinder . getPort ( function ( err , port ) { if ( err ) throw ( err ) ; handles . port = port ; fs . writeFileSync ( path . join ( handles . filepath , 'index.txt' ) , 'hello, world' ) ; app . use ( proxy . initialize ( config ) ) ; app . use ( express . static ( handles . filepath ) ) ; handles . server = require ( 'http' ) . createServer ( app ) ; handles . server . listen ( handles . port , function ( ) { done ( null , handles . port ) ; } ) ; } ) ; } ) ; }
Configures an express instance on a dynamically assigned port
for serving static files and proxying requests based on the config.

@param  {Object.<string, string>} config   the config of the json-proxy for
this test suite
@param  {Function} done callback
Configures an express instance on a dynamically assigned port for serving static files and proxying requests based on the config .