Last Updated: February 25, 2016
·
179
· crungmungus

Quickly serve up static assets with node

Previously when I wanted to quickly serve up some HTML/JavaScript I'd use a boilerplate Express app but it's actually even easier to use the http-server package.

Globally install the awesome http-server package

npm install -g http-server

Then run this from the folder with your assets

http-server -c-1

"-c Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1."

For more info see:

https://github.com/indexzero/http-server