aboutsummaryrefslogtreecommitdiffstats
path: root/routes/locations.js
blob: d3557085547cafb4edc2baabea6b127b88a618ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import app from "app";
import redis from "lib/redis";
import got from "got";

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();