http-server

http-server是基于node.js的一个简单、零配置的命令行web服务器,可以方便实现跨域资源请求,

#全局安装:

npm install http-server -g; 全局安装后就可以通过命令行来启动了

使用:

http-

#安装为一个node应用

/-

使用:

本地启动http-server:

node bin/http-

可用的选项:

-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

-S 或 --ssl:Enable https.

-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.

相关文章

问题背景 最近小伙伴提了一个希望提高后台下拉列表可操作性的...
// n位随机数生成 function randomNum(n) { let sString = &...
HTML是HyperText Markup Language的简称,中文名称:超文本标...
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现...
JavaScript 是脚本语言,是一种解释性脚本语言(代码不进行预...
本文由葡萄城技术团队原创并首发 转载请注明出处:葡萄城官网...