You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+92Lines changed: 92 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,98 @@ npm install
68
68
npm run build
69
69
```
70
70
71
+
## API 🚀
72
+
73
+
WhereRoulette provides a simple API using Netlify Edge Functions to retrieve POIs within a specified region. Mix some randomness into your apps or get details about specific locations! ✨
74
+
75
+
### POI Endpoint ⚡
76
+
77
+
```bash
78
+
GET https://whereroulette.com/api
79
+
```
80
+
81
+
#### Query Parameters 🔍
82
+
83
+
| Parameter | Description | Required | Default |
84
+
|-----------|-------------|----------|---------|
85
+
| region | OpenStreetMap region ID | Yes | - |
86
+
| type | POI category (drinks, cafe, food, park, climb) | No | drinks |
87
+
| id | Specific OSM node ID (e.g., "node/11967421222" or just "11967421222") | No | - |
"error": "Invalid type. Must be one of: drinks, cafe, food, park, climb"
132
+
}
133
+
```
134
+
135
+
**No POIs Found:**
136
+
137
+
```json
138
+
{
139
+
"error": "No climb found in region 62422"
140
+
}
141
+
```
142
+
143
+
**Node Not Found:**
144
+
145
+
```json
146
+
{
147
+
"error": "Node with ID node/12345678 not found"
148
+
}
149
+
```
150
+
151
+
### Technical Implementation 🛠️
152
+
153
+
The API is implemented as a Netlify Edge Function, which provides fast, globally distributed response times. It directly queries the Overpass API to fetch OpenStreetMap data and converts it to a simplified format optimized for POI information.
154
+
155
+
The configuration in `netlify.toml` maps the `/api` path to the Edge Function:
0 commit comments