The http-server package is a simple, self-contained command-line HTTP server for delivering static application files during local testing. section 9.5.1
Serve a production build
After building the application, run `npx http-server@14.1.1 dist/example --port 5000`. The command downloads and executes the package, serves the dist/example directory, and listens on port 5000. Open http://localhost:5000 in a browser; stop the server with Control+C. section 9.5.1
Prerendering uses the same workflow: generate static HTML first, then serve the resulting browser directory separately. With JavaScript disabled, the browser receives prerendered documents; with JavaScript enabled, the application rehydrates them. section 27.5.2
Use the module when you need to:
- Inspect a production build through a local HTTP URL rather than opening files directly. section 9.5.1
- Deliver prerendered application output after the prerender command has created static HTML. section 27.5.2
- Test loading behavior under simulated fast or slow 3G network conditions. section 8.2.5
Listing 9.18. Running the production build
npx http-server@14.1.1 dist/example --port 5000
Shows the complete command for serving a production build with http-server 14.1.1 on port 5000. section 9.5.1

