Problem
The dataset is the most useful thing this project has, and the only way to consume it programmatically is to clone the repo and parse the JSON files yourself. There is no way to build anything on top of it.
Where to start
data/places/*.json - the source files, one per category
data/places.schema.json - the existing contract, document this rather than inventing a second one
- Add the route under
src/app/api/places/
What to build
GET /api/places returning the merged dataset, with optional city, category and country filters.
Bound the response. Returning every record unpaginated will not age well as the dataset grows, so add limit and offset with a sane default and a hard maximum.
Set cache headers that reflect reality: the data changes a few times a week at most.
Enable permissive CORS, since the entire point is other people's browsers.
Add a short docs page describing the response shape and linking the schema.
Acceptance criteria
Verifying
npm install
npm run dev
curl "http://localhost:3000/api/places?city=Mumbai&limit=5"
curl "http://localhost:3000/api/places?limit=999999" # should clamp, not dump everything
Scope: medium, roughly 2 hours.
New to the repo? Start with CONTRIBUTING.md.
Problem
The dataset is the most useful thing this project has, and the only way to consume it programmatically is to clone the repo and parse the JSON files yourself. There is no way to build anything on top of it.
Where to start
data/places/*.json- the source files, one per categorydata/places.schema.json- the existing contract, document this rather than inventing a second onesrc/app/api/places/What to build
GET /api/placesreturning the merged dataset, with optionalcity,categoryandcountryfilters.Bound the response. Returning every record unpaginated will not age well as the dataset grows, so add
limitandoffsetwith a sane default and a hard maximum.Set cache headers that reflect reality: the data changes a few times a week at most.
Enable permissive CORS, since the entire point is other people's browsers.
Add a short docs page describing the response shape and linking the schema.
Acceptance criteria
/api/placesreturns the dataset with workingcity,categoryandcountryfilterslimitandoffsetwork, with a documented default and maximumdata/places.schema.jsonVerifying
Scope: medium, roughly 2 hours.
New to the repo? Start with CONTRIBUTING.md.