当前位置:首页 > Web开发 > 正文

最简单的可以输入:hs 在浏览器中输入::8081/index.html 3.配置 步骤2中直接使用了hs(http-s

2024-03-31 Web开发

http-server的特点:

http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it‘s simple and hackable enough to be used for testing, local development, and learning.

也正是这样,vue和node.js开发过程中都是内置了http-server,自动刷新,,出格便利。

介绍日常静态文件测试开发时的使用。

1.安置

1 npm install --global http-server

全局安置后可以在cmd中检察:

1 npm view http-server 2 npm info http-server 3 // or 4 npm -v hs

http-server简写为hs

2.使用

项目目录内容如下:

技术图片

cmd进入项目目录,最简单的可以输入:hs

在浏览器中输入::8081/index.html

技术图片

 3.配置

法式2中直接使用了hs(http-server)命令,固然实际的过程中可以使用很多配置,

如:hs 目录 -a 地点 -p 端口

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31298.html