简易web服务器(npm)

npm install -g http-server 以后可以在任何一个文件夹启动静态文件的访问通过
http-server -a localhost -p 8000
ctrl + c结束

http-server -h

npm 仓库地址: https://www.npmjs.com/package/http-server

git-hub: https://github.com/indexzero/http-server

-p 端口号 (默认 8080) -a IP 地址 (默认 0.0.0.0) -d 显示目录列表 (默认 \'True\') -i 显示 autoIndex (默认 \'True\') -e or --ext 如果没有提供默认的文件扩展名(默认 \'html\') -s or --silent 禁止日志信息输出 --cors 启用 CORS via the Access-Control-Allow-Origin header -o 在开始服务后打开浏览器 -h or --help 打印列表并退出 -c 为 cache-control max-age header 设置Cache time(秒) , e.g. -c10 for 10 seconds (defaults to \'3600\'). 禁用 caching, 则使用 -c-1.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zgwzyf.html