Loading...

小程序云函数,解决接口https问题

本实例只是简单记录http请求

1,云函数如下

// 云函数入口函数
exports.main = async (event, context) => {
  let req = await got('http://xxx:9090/xxx/xxx')
  return req.body
}

2,调用实例

wx.cloud.callFunction({
      name: 'http'
    }).then(res => {
      console.info(JSON.parse(res.result).ret)
    }).catch(err => {
      
    })

 

posted @ 2019-06-13 09:39  微笑阳光哈*_*  阅读(928)  评论(0编辑  收藏  举报