aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/locations/+server.js
blob: 48eb9fc67dde0e756a6e7740528de196e3dcc3b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { json } from '@sveltejs/kit';

export async function GET({ fetch, setHeaders }) {
	let r = await fetch('https://api.btcmap.org/v2/elements?updated_since=2022-09-19');

	let locations = await r.json();
	locations = locations.filter(
		(l) => l['osm_json'].tags && l['osm_json'].tags['payment:coinos'] === 'yes'
	);

	let headers = {
		'cache-control': 'public, max-age=600'
	};

	setHeaders(headers);

	return json({ locations });
}