Visit HTML Pages »
Each of us already wanted to share a certain directory on our network by running just a command little command, Am I right? Then this module is exactly what you're looking for: It provides a beautiful interface for listing the directory's contents and switching into sub folders.
In addition, it's also awesome because it comes to serving static sites. If a directory contains an
html-pages will automatically render it instead of serving directory contents, and will serve any
.html file as a rendered page instead of file's content as plaintext.
Another huge reason to use this package is that AJAX requests don't work with the
You need to have node.js (
>v.6.6.0) and npm installed. You should probably install this globally.
npm install -g html-pages
This will install
html-pages globally so that it may be run from the command line.
git clonecd html-pagesnpm install # Local dependencies if you want to hacknpm install -g # Install globally
You just have to call the command
html-pages in your project's directory. Alternatively you can add the path to be a command line parameter.
Run this command to see a list of all available options:
-a, --auth— Enables http-auth using the
-b, --browserstring — Specify browser to use instead of system default
-c, --cachenumber — Time in milliseconds for caching files in the browser (defaults to 3600)
-C, --cors— Setup CORS headers to allow requests from any origin
-d, --directory-indexfile — The index file of a directory. Set to empty
""to always show the directory listing (defaults to index.html)
-h, --help— Output usage information
-i, --ignorestring/array — Files and directories to ignore. Use a string (comma-separated string for paths to ignore) if your are using the command line and an array if you are calling it via API
--no-browser— Suppress automatic web browser launching
--no-cache— Disabled the caching files in the browser
--no-clipboard— Don't copy address to clipboard
--no-listing— Turn off the directory listings
--no-notifications— Suppress automatic notifications launching
--no-port-scan— Disabled the port scanning when the selected port is already in use
-p, --portnumber — Port to listen on (defaults to 8084)
-r, --rootstring — The root directory (defaults to ./)
-s, --silent— Don't log anything to the console
-u, --unzipped— Disable GZIP compression
-v, --version— Output the version number
If a file
~/.html-pages.json exists it will be loaded and used as default options for html-pages on the command line. See Options for option names.
If you set the
--auth flag, this package will look for a username and password in the
PAGES_PASSWORD environment variables.
As an example, this is how such a command could look like:
PAGES_USER=daniel PAGES_PASSWORD=1904 html-pages --auth
You can also use the package inside your application. Just load it:
const pages =
And call it with flags (check Command line parameters for the full list):
const pagesServer =
To stop the server just use the method:
'User-agent: *\nDisallow: /');