小程序云函数,解决接口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 => {
      
    })

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM