Opens in a new tab

Run http-server: Zero-config HTTP Server

Don’t forget to subscribe to our YouTube channel to stay up-to-date.

http-server is a zero-configuration command-line node tool for creating static HTTP servers.

It’s useful if you want to run an HTTP server to test stuff locally.

However, the documentation states, “It is powerful enough for production usage…”

Installation options:

  1. On-demand: npx http-server [path] [options]
  2. Global npm: `npm install –global http-server`
  3. Homebrew: brew install http-server
  4. As a dependency: npm install http-server

Usage is straightforward: http-server [path] [options]

The default path is ./public if it exists, otherwise ./

Key features:

  • Easy installation and usage
  • Runs on-demand with npx
  • Global installation via npm or Homebrew
  • Customizable port and address settings

http-server offers numerous configuration options, including custom ports, file extensions, caching, and proxy settings. It also supports “magic files” like index.html for directory requests and 404.html for missing files.

Let us know how you’re using http-server in your development workflow.

Leave the first comment

✦ WebWash Premium

Go deeper with Premium

Lifetime access to every premium course, the private member forum and member-only live streams.

16+ in-depth courses
Private member forum
Member-only live streams
Ad-free, forever
Get lifetime access · €99

One-time payment · plus VAT