//koa封装的请求第三方接口的方法(koa2-request)
const koaRequest = require('koa2-request')
const btoa = require('btoa')
let res = koaRequest({
//极光推送的api
url: 'https://api.jpush.cn/v3/push/cid',
method: 'get',
headers: {
'Content-Type': 'application/json',
// 通过 Authorization 传递 base64 编码后的AppKey和Master Secret
'Authorization': 'Basic ' + btoa('你的appkey:你的密钥')
}
});
//获取得到的是字符串,先将字符串转换为对象,才能获取cid
const cid = JSON.parse(res.body).cidlist[0]
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。