http-server: a command-line http server
http-server
is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
Installation via npm
:
npm install http-server -g
his will install http-server
globally so that it may be run from the command line.
Running on-demand:
Using npx
you can run the script without installing it first:
npx http-server [path] [options]
Usage:
http-server [path] [options]
[path]
defaults to ./public
if the folder exists, and ./
otherwise.
Now you can visit http://localhost:8080 to view your server
Note: Caching is on by default. Add -c-1
as an option to disable caching.
詳細配置請查看:
https://www.npmjs.com/package/http-server#http-server-a-command-line-http-server