diff --git a/README.md b/README.md index a2cc108..5e83173 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,8 @@ Options: -H --host HOST Bind address HOST (default=*) +-l --localhost Same as "--host localhost" + -d --dir DIRECTORY Serve the contents of DIRECTORY (default=cwd) -u --url MOUNTURL Serve the contents at MOUNTURL mount path (default=/) @@ -281,6 +283,6 @@ traversal, then you are encouraged to please refactor so that you do not depend on having `..` in url paths, as this tends to expose data that you may be surprised to be exposing. -Consider using the `--host localhost` setting if you don't want other +Consider using the `--localhost` setting if you don't want other people on your local network to read the files served by the command line server. This may become the default in a future major version. diff --git a/bin/server.js b/bin/server.js index 2539b39..97d77ec 100755 --- a/bin/server.js +++ b/bin/server.js @@ -27,6 +27,11 @@ for (var i = 2; i < process.argv.length; i++) { } break + case '-l': + case '--localhost': + host = 'localhost' + break + case '-d': case '--dir': dir = process.argv[++i] @@ -108,6 +113,8 @@ function help () { ,'' ,'-H --host HOST Bind address HOST (default=*)' ,'' +,'-l --localhost Same as "--host localhost"' +,'' ,'-d --dir DIRECTORY Serve the contents of DIRECTORY (default=cwd)' ,'' ,'-u --url /url Serve at this mount url (default=/)'