aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/locations.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/routes/locations.js b/routes/locations.js
new file mode 100644
index 00000000..3e0fee4c
--- /dev/null
+++ b/routes/locations.js
@@ -0,0 +1,19 @@
+import app from "$app";
+import redis from "$lib/redis";
+import axios from "axios";
+
+let locations;
+app.get("/locations", async (req, res) => {
+ res.send({ locations });
+});
+
+let getLocations = async () => {
+ let { data } = await axios.get('https://api.btcmap.org/v2/elements?updated_since=2022-09-19');
+ locations = data.filter(
+ (l) => l['osm_json'].tags && l['osm_json'].tags['payment:coinos'] === 'yes'
+ );
+
+ setTimeout(getLocations, 60000);
+}
+
+getLocations();