diff options
| author | Adam Soltys <[email protected]> | 2023-01-08 21:05:34 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-08 21:05:34 -0800 |
| commit | dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7 (patch) | |
| tree | 6c6b8930ebe9c2cc5b8d1f759e61260f509fdd7a /routes/locations.js | |
| parent | f7b844883506a8072213245b9b8a2b988694e4f5 (diff) | |
| download | coinos-server-dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7.tar.gz coinos-server-dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7.zip | |
tech debt jubilee
Diffstat (limited to 'routes/locations.js')
| -rw-r--r-- | routes/locations.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/routes/locations.js b/routes/locations.js index 63bfe1a1..1cebc883 100644 --- a/routes/locations.js +++ b/routes/locations.js @@ -1,19 +1,21 @@ import app from "$app"; import redis from "$lib/redis"; -import axios from "axios"; +import got from "got"; -let locations; +let locations = []; app.get("/locations", async (req, res) => { res.send({ locations }); }); let getLocations = async () => { - let { data } = await axios.get( + try { + let r = await got( "https://api.btcmap.org/v2/elements?updated_since=2022-09-19" - ); - locations = data.filter( + ).json(); + locations = r.filter( l => l["osm_json"].tags && l["osm_json"].tags["payment:coinos"] === "yes" ); + } catch(e) {} setTimeout(getLocations, 60000); }; |
