大佬教程收集整理的这篇文章主要介绍了http-server,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
http-server是基于node.js的一个简单、零配置的命令行web服务器,可以方便实现跨域资源请求,
#全局安装:
npm install http-server -g; 全局安装后就可以通过命令行来启动了
使用:
title="http-server" alt="http-server" src="https://cn.js-code.com/res/2019/01-14/23/39f73db0e1e933449346c49dfcccbdca.png" >
#安装为一个node应用
使用:
本地启动http-server:
可用的选项:
-p:端口号(默认使用8080)
-a:address to use(默认使用0.0.0.0)
-d:Show directory lisTings (defaults to 'True')
-i:Display autoIndex (defaults to 'True')
-e 或 --ext:Default file extension if none supplied (defaults to 'html')
-s 或 --silent:Suppress log messages from output
--cors:Enable CORS via the `Access-Control-Allow-Origin` header
-o:Open browser window after starTing the server
-c:Set cache time (in seconds) for cache-control max-age header,e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching,use -c-1.
-U 或 --utc:Use UTC time format in log messages.
-P 或 --proxy:Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com
-C 或 --cert:Path to ssl cert file (default: cert.pem).
-K 或 --key:Path to ssl key file (default: key.pem).
-r 或 --robots:Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /')
-h 或 --Help:Print this list and exit.
以上是大佬教程为你收集整理的http-server全部内容,希望文章能够帮你解决http-server所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。