加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

http-server

发布时间:2020-12-14 23:59:15 所属栏目:资源 来源:网络整理
导读:http-server是基于node.js的一个简单、零配置的命令行web服务器,可以方便实现跨域资源请求, #全局安装: npm install http-server -g; 全局安装后就可以通过命令行来启动了 使用: http- #安装为一个node应用 / - 使用: 本地启动http-server: node bin/h

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读