Run http-server: Zero-config HTTP Server

Published: 28 August 2024
on channel: WebWash
127
2

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:
➜ On-demand: npx http-server [path] [options]
➜ Global npm: npm install --global http-server
➜ Homebrew: brew install http-server
➜ 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.

#nodejs #http
~~~
If you found this post helpful.

♻️ Please repost and follow.

📧 Join my newsletter; link in the first comment.


On this page of the site you can watch the video online Run http-server: Zero-config HTTP Server with a duration of hours minute second in good quality, which was uploaded by the user WebWash 28 August 2024, share the link with friends and acquaintances, this video has already been watched 127 times on youtube and it was liked by 2 viewers. Enjoy your viewing!