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
return json({ error: 'No search provided' }, { status: 400 });
7
}
8
0
0
0
0
9
try {
10
-
const url = 'https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(q);
11
-
console.log(url);
12
-
const data = await fetch(url);
13
const location = await data.json();
14
15
return json(location[0]);
16
} catch (error) {
17
-
console.error('Error fetching location:', error);
18
return json({ error: 'Failed to fetch location' }, { status: 500 });
19
}
20
}
···
6
return json({ error: 'No search provided' }, { status: 400 });
7
}
8
9
+
const nomUrl =
10
+
'https://nominatim.openstreetmap.org/search?format=json&q=' + encodeURIComponent(q);
11
+
console.log(url);
12
+
13
try {
14
+
const data = await fetch(nomUrl);
0
0
15
const location = await data.json();
16
17
return json(location[0]);
18
} catch (error) {
19
+
console.error('Error fetching location:', nomUrl, error);
20
return json({ error: 'Failed to fetch location' }, { status: 500 });
21
}
22
}