server.js
function getArguments() {
  var port = 3000;
  var path = '.';
  var args = process.argv.slice(2);

  while (args.length) {
    var arg = args.shift();
    switch (arg) {
      case '-p':
        port = args.shift();
        break;
      default:
        path = arg || path;
    }
  }

  return {
    port: port,
    path: path
  };
}
function getArguments() {
  var port = 3000;
  var path = '.';
  var args = process.argv.slice(2);

  while (args.length) {
    var arg = args.shift();
    switch (arg) {
      case '-p':
        port = args.shift();
        break;
      default:
        path = arg || path;
    }
  }

  return {
    port: port,
    path: path
  };
}
function getArguments ( ) { var port = 3000 ; var path = '.' ; var args = process . argv . slice ( 2 ) ; while ( args . length ) { var arg = args . shift ( ) ; switch ( arg ) { case '-p' : port = args . shift ( ) ; break ; default : path = arg || path ; } } return { port : port , path : path } ; }
Get port and application folder path from command line arguments. Use port from "-p" or fallback to 3000. Default folder is the current folder.
Get port and application folder path from command line arguments . Use port from - p or fallback to 3000 . Default folder is the current folder .