From 1cdeccc7a7186901b7ed3356bf4f7c28113f1f84 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 5 May 2016 21:28:41 -0700 Subject: [PATCH] #885 added command line option --directory -D to specify base directory --- app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 90c30c9e26..8e7bb15ec2 100644 --- a/app.js +++ b/app.js @@ -19,6 +19,7 @@ // Defaults options.port = options.port || options.p || 8080; + options.directory = options.directory || options.D || '.'; ['include', 'exclude', 'i', 'x'].forEach(function (opt) { options[opt] = options[opt] || []; // Make sure includes/excludes always end up as arrays @@ -36,6 +37,7 @@ console.log(" --port, -p Specify port."); console.log(" --include, -i Include the specified bundle."); console.log(" --exclude, -x Exclude the specified bundle."); + console.log(" --directory, -D Serve files from specified directory."); console.log(""); process.exit(0); } @@ -71,7 +73,7 @@ }); // Expose everything else as static files - app.use(express['static']('.')); + app.use(express['static'](options.directory)); // Finally, open the HTTP server app.listen(options.port);