aboutsummaryrefslogtreecommitdiffstats
path: root/routes/locations.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-16 23:40:25 -0800
committerAdam Soltys <[email protected]>2023-01-16 23:40:25 -0800
commit91e847126c832efa25ab0bf8d6f3b7e537378fa7 (patch)
tree4a42b6e3bec6eb0f640ed44533b54e6d3d6a5e0e /routes/locations.js
parent6bafea9bffe24d2227d269812a73a9a513d92ddf (diff)
downloadcoinos-server-91e847126c832efa25ab0bf8d6f3b7e537378fa7.tar.gz
coinos-server-91e847126c832efa25ab0bf8d6f3b7e537378fa7.zip
shuffle things around
Diffstat (limited to 'routes/locations.js')
-rw-r--r--routes/locations.js28
1 files changed, 6 insertions, 22 deletions
diff --git a/routes/locations.js b/routes/locations.js
index 1cebc883..e080a7b9 100644
--- a/routes/locations.js
+++ b/routes/locations.js
@@ -1,23 +1,7 @@
-import app from "$app";
-import redis from "$lib/redis";
-import got from "got";
+import { g } from "$lib/db";
-let locations = [];
-app.get("/locations", async (req, res) => {
- res.send({ locations });
-});
-
-let getLocations = async () => {
- try {
- let r = await got(
- "https://api.btcmap.org/v2/elements?updated_since=2022-09-19"
- ).json();
- locations = r.filter(
- l => l["osm_json"].tags && l["osm_json"].tags["payment:coinos"] === "yes"
- );
- } catch(e) {}
-
- setTimeout(getLocations, 60000);
-};
-
-getLocations();
+export default {
+async list(req, res) {
+ res.send({ locations: await g('locations') });
+}
+}