1

很多情况下,需要在本地开启http服务器来测试,之前经常要写一个简单的 node demo,最近发现'http-server'可以帮助我们启动一个http服务,深深感慨,没文化,真阔怕!

1. 安装:

安装通过npm:进行全局安装

npm install http-server -g

2. 使用

新建一个demo目录

clipboard.png
新建一个 html 文件

<!DOCTYPE>
<html>
  <body>welcome to pwa</body>
</html>

打开cmd,移动进入当前文件夹,在当前文件夹内输入命令即可

http-server [path] [options]

3. 效果

clipboard.png


默默
5 声望0 粉丝