问题的提出
Mac环境
方便快捷地搭建小程序的测试服务器
小程序对于网络请求的URL的特殊要求
不能出现端口号
不能用localhost
必须用https
主要步骤
用json-server搭建简单的服务器,搭建出来的服务器地址为localhonst:3000
安装nginx进行反向代理,以便隐藏端口号和替换localhost
搭建https服务
微信小程序设置
用到的工具
json-server
nginx
openssl
微信小程序官方开发工具
json-server的使用
安装
sudo npm install -g json-server
选一个文件目录新建json文件,比