https://www.npmjs.com/package/http-server
安装 http-server
npm i http-server
禁止 http-server缓存
禁用缓存, 使用 -c-1
http-server -c-1
禁用缓存, 使用 -c-1,自动打开浏览器
http-server -o -c-1
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 在开始服务后打开浏览器-c 为 设置缓存控制max-age头的缓存时间(秒) , 如-c10即 10s (默认 为 '3600')-U 或 --utc 使用UTC time 格式化log消息-P or --proxy 代理无法在本地解决给定网址对所有请求 如: -P http://someurl.com-S or --ssl 启用 https-C or --cert ssl证书文件路径 (默认值: cert.pem)-K or --key ssl密钥文件路径 (默认值: key.pem).-r or --robots 提供一个 /robots.txt (其内容默认为'User-agent: *\nDisallow: /')-h or --help 打印此列表并退出
