http-server 本地测试前端项目服务器

1. 安装 nodejs

地址:https://nodejs.org/zh-cn/

2. 全局安装 http-server

  npm install http-server -g

3. 开启 http-server服务

切换到需要运行的dist文件目录上层、

命令:http-server ./dist -p 8081 -o -P http://www.baidu.com
// -p 8081  设置端口号,不写代表默认使用8080
// -o       服务器启动后打开浏览器窗口
// -P http://www.xxx.com 设置跨域的api接口
// -S       启用HTTPS
posted @ 2021-05-14 15:51  云鹤^  阅读(221)  评论(0)    收藏  举报