小程序发送post请求

10 min read
const post = function(message){
  wx.request({
    url: 'http://localhost:9999/logs', //仅为示例,并非真实的接口地址
    data: {
        message:JSON.stringify(message)
     }, 
    method:"POST",
    header: { 
      'content-type': 'application/json' 
    }
  })
}

const info =  (message)=>{
  console.log(message)
  post(message)
}

module.exports = {
    info
}