Read the full article at: Serve a Directory with Node.js Read the full article at: Serve a Directory with Node.js As I mentioned in  S...

Serve a Directory with Node.js

Read the full article at: Serve a Directory with Node.js


Read the full article at: Serve a Directory with Node.js

As I mentioned in Serve a Directory with Python, sometimes you need a directory to be "served" instead of loading the file:// location within your browser.  In the past I would mess around with MAMPStack and swapping out httpdocs directories, but there are better tools these days.

If you prefer to use Node.js instead of Python, you can use the http-server package:
# Install via shell
npm install http-server -g

# Serve a directory
http-server

# Serve a directory at a specified port
http-server -p 2020
Check out the http-server NPM page to check out specific options, but I wanted to highlight how easy it can be to serve a directory with Node.js.  And for JavaScript lovers like me...Node.js is the way to go.  [Continue Reading…]

via David Walsh Blog