From dce07aa93b3c2f47aca0c24cea6adde9ec37f1a7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 8 Jan 2023 21:05:34 -0800 Subject: tech debt jubilee --- routes/locations.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'routes/locations.js') 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); }; -- cgit v1.2.3