简单的零配置命令行HTTP服务器
HTTP -server是基于nodeJs的一个简单零配置命令行HTTP服务器。
nodeJs 的 web-server.Js:
安装 (全局安装加 -g) :
npm install http-server
Windows 下使用:
在站点目录下开启命令行输入
http-server
和package.json一起使用
“scripts“:{“start“:“http-server -a 0.0.0.0-p 8000“,}
参考:
-p 端口号(默认8080)-IP地址(默认为0.0.0.0)-d显示列表(默认状态为“True”)-i显示自动索引(默认状态为“true”)- e 或-- ext,如果没有提供默认的文件扩展名(默认的‘ html’)-s or--silent 禁止使用日志管理信息进行输出--Corssomething cors allows the origin to nod through access control-o 在开始服务后打开浏览器-C set the cache time (seconds)for the cache control maximum age header, eG.-c10 10seconds(default:3600).如果已禁用缓存,-C-1- U something --UTC something UTC something something something something something log something Por-- proxy all requests that can not be resolved locally to the given url.e[UNK] g.[UNK]-P http://someurl.Com-s or -- ssl something https-c or -- Cert ssl cert something (default: Cert) .PEM) - K or --SSLkey file key path (default: key).Pem).-r or -- robots provides a /robots.Txt (its content defaults to "user agent: * \ n default: /") - H or -- help print the above list and exit