lib/nproxy.js
function nproxy(port, options){
  var nm;

  if(typeof options.timeout === 'number'){
    utils.reqTimeout = options.timeout;
    utils.resTimeout = options.timeout;
  }

  if(typeof options.debug === 'boolean'){
    log.isDebug = options.debug;
  }

  nm = require('./middlewares'); //nproxy middles

  port = typeof port === 'number' ? port : DEFAULT_PORT;

  app = connect();
  if(typeof options.responderListFilePath !== 'undefined'){
    app.use(nm.respond(options.responderListFilePath));
  }
  app.use(nm.forward());

  httpServer = http.createServer(function(req, res){
    req.type = 'http';
    app(req, res);
  }).listen(port);

  proxyHttps();

  log.info('NProxy started on ' + port + '!');

  if (options.networks) {
    log.info('Network interfaces:');
    var interfaces = require('os').networkInterfaces();
    for (var key in interfaces) {
      log.info(key);
      interfaces[key].forEach(function (item) {
        log.info('  ' + item.address + '\t' + item.family);
      });
    }
  }

  return {
    httpServer: httpServer
  };
}
function nproxy(port, options){
  var nm;

  if(typeof options.timeout === 'number'){
    utils.reqTimeout = options.timeout;
    utils.resTimeout = options.timeout;
  }

  if(typeof options.debug === 'boolean'){
    log.isDebug = options.debug;
  }

  nm = require('./middlewares'); //nproxy middles

  port = typeof port === 'number' ? port : DEFAULT_PORT;

  app = connect();
  if(typeof options.responderListFilePath !== 'undefined'){
    app.use(nm.respond(options.responderListFilePath));
  }
  app.use(nm.forward());

  httpServer = http.createServer(function(req, res){
    req.type = 'http';
    app(req, res);
  }).listen(port);

  proxyHttps();

  log.info('NProxy started on ' + port + '!');

  if (options.networks) {
    log.info('Network interfaces:');
    var interfaces = require('os').networkInterfaces();
    for (var key in interfaces) {
      log.info(key);
      interfaces[key].forEach(function (item) {
        log.info('  ' + item.address + '\t' + item.family);
      });
    }
  }

  return {
    httpServer: httpServer
  };
}
function nproxy ( port , options ) { var nm ; if ( typeof options . timeout === 'number' ) { utils . reqTimeout = options . timeout ; utils . resTimeout = options . timeout ; } if ( typeof options . debug === 'boolean' ) { log . isDebug = options . debug ; } nm = require ( './middlewares' ) ; //nproxy middles port = typeof port === 'number' ? port : DEFAULT_PORT ; app = connect ( ) ; if ( typeof options . responderListFilePath !== 'undefined' ) { app . use ( nm . respond ( options . responderListFilePath ) ) ; } app . use ( nm . forward ( ) ) ; httpServer = http . createServer ( function ( req , res ) { req . type = 'http' ; app ( req , res ) ; } ) . listen ( port ) ; proxyHttps ( ) ; log . info ( 'NProxy started on ' + port + '!' ) ; if ( options . networks ) { log . info ( 'Network interfaces:' ) ; var interfaces = require ( 'os' ) . networkInterfaces ( ) ; for ( var key in interfaces ) { log . info ( key ) ; interfaces [ key ] . forEach ( function ( item ) { log . info ( '  ' + item . address + '\t' + item . family ) ; } ) ; } } return { httpServer : httpServer } ; }
Start up nproxy server on the specified port
and combine the processors defined as connect middlewares into it.

@param {String} port the port proxy server will listen on
@param {Object} options options for the middlewares
Start up nproxy server on the specified port and combine the processors defined as connect middlewares into it .