tangled
alpha
login
or
join now
flo-bit.dev
/
blento
your personal website on atproto - mirror
blento.app
20
fork
atom
overview
issues
pulls
pipelines
logs
Florian
1 month ago
5a13fdd8
b5df8d69
+6
-4
1 changed file
expand all
collapse all
unified
split
src
routes
api
geocoding
+server.ts
+6
-4
src/routes/api/geocoding/+server.ts
···
6
6
return json({ error: 'No search provided' }, { status: 400 });
7
7
}
8
8
9
9
+
const nomUrl =
10
10
+
'https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(q);
11
11
+
console.log(url);
12
12
+
9
13
try {
10
10
-
const url = 'https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(q);
11
11
-
console.log(url);
12
12
-
const data = await fetch(url);
14
14
+
const data = await fetch(nomUrl);
13
15
const location = await data.json();
14
16
15
17
return json(location[0]);
16
18
} catch (error) {
17
17
-
console.error('Error fetching location:', error);
19
19
+
console.error('Error fetching location:', nomUrl, error);
18
20
return json({ error: 'Failed to fetch location' }, { status: 500 });
19
21
}
20
22
}