我想拿这个现成的 api 来做接口来自己给小程序使用,https://github.com/CaptEmulation/clash-of-clans-api,不知道该怎么操作。
![]() | 1 1KN6sAqR0a57no6s 2020-12-16 23:19:57 +08:00 https://github.com/CaptEmulation/clash-of-clans-api Nodejs 起一个 http 服务,收到小程序的请求,调用这个 API,返回给小程序,这不是很简单嘛 const express = require("express"); const clashApi = require("clash-of-clans-api"); const app = express(); let client = clashApi({ token: yourApiToken, request: { proxy: process.env.MY_PROXY, }, }); app.get("/api/clan-by-tag", (req, res) => { client .clanByTag('#'+req.query.tag) .then(respOnse=> res.end(response)) }); app.listen(3000); |
![]() | 2 BaiLinfeng OP @YuxiangLuo 老铁写的这个 get 路径是几个意思?没明白,还有你这个 proxy 代理,这里可以不使用代码吗? |
3 iamyow 2020-12-17 00:42:10 +08:00 github 上不是写得很清楚了吗?安装、注册,再配置你的 nodejs 项目 token,然后 request-promise 的写法,都有例子啊。最后还有个手把手教你的链接。 |
![]() | 4 BaiLinfeng OP @iamyow 表示没看懂,难受 |
5 iamyow 2020-12-18 00:33:06 +08:00 |
![]() | 6 BaiLinfeng OP @iamyow 这个教程我看了,还是没有弄出来。不知道怎么使用了。 |