查看: 107|回覆: 0

node.js中http-server的使用

[複製鏈接]

4

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2009-9-21
發表於 2020-1-20 11:42:00 | 顯示全部樓層 |閲讀模式

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

 

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

 

 

 3.配置

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

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

 

更多配置请参考:

https://github.com/http-party/http-server

 



来源:https://www.cnblogs.com/jyughynj/p/12217317.html
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部