本地文件服务器,使用http -server 搭建本地简易文件服务器

安装

npm install http-server -g

使用

1. cd project .

2. hs [pwd] -o, 默认是当前路径 ./

3. 其他选项

-p Port to use (defaults to 8080) (常用)

-a Address to use (defaults to 0.0.0.0) (更换主机,基本不用)

-d Show directory listings (defaults to 'True') (展示目录,基本不用)

-i Display autoIndex (defaults to 'True') (默认打开index.html)

-g or --gzip When enabled (defaults to 'False') it will serve ./public/some-file.js.gz in place of ./public/some-file.js when a gzipped version of the file exists and the request accepts gzip encoding. (压缩文件优先, 基本不用)

-e or --ext Default file extension if none supplied (defaults to 'html') (默认文件后缀)

-s or --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 or --utc Use UTC time format in log messages. (打印时间的格式)

-S or --ssl Enable https. (打开https)

常用

hs ./afaf -p 9999 -o

-o 要放在最后

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值