Run:
bun run server.ts
Base URL: http://localhost:8787
-
GET /health
- Returns:
{ ok: true }
- Returns:
-
GET /csv
- Returns raw CSV (
text/csv
)
- Returns raw CSV (
-
GET /columns
- Returns:
{ columns: string[] }
- Notes: Header normalization applied
- "Uplad Date" → "Upload Date"
- Duplicate "Latitude" → last becomes "Longitude"
- Returns:
-
GET /grep
- Query:
pattern
(required): regex patternflags
(optional): JS regex flags (e.g.i
,m
)max
(optional): max matches (default 200, cap 1000)
- Returns:
{ count: number, matches: { line: number, text: string }[] }
- Query:
-
GET /unique
- Query:
column
(required): column name (raw or normalized)limit
(optional): max unique values (default 1000, cap 5000)
- Returns:
{ column: string, values: string[] }
- Aliases supported:
Upload Date
: ["Uplad Date","Upload Date","Timestamp","Date"]Latitude
: ["Latitude","Lat"]Longitude
: ["Longitude","Lat_1","Latitude_1","Latitude (2)","Lng"]Police Station
: ["Police Station","PoliceStation","police_station"]Festival/Event Name
: ["Festival/Event Name","FestivalEventName","festival_event_name"]Point Name
: ["Point Name","PointName","point_name"]Section/Appendix
: ["Section/Appendix","SectionAppendix","section_appendix"]
- Query:
-
GET /counts
- Query:
column
(required): column name (raw or normalized)
- Returns:
{ column: string, counts: { value: string, count: number }[] }
sorted desc by count
- Query:
- Health:
/health
- Columns:
/columns
- Raw CSV:
/csv
- Grep (example):
/grep?pattern=Sinnar&flags=i&max=50
- Unique police stations:
/unique?column=Police%20Station
- Counts by police station:
/counts?column=Police%20Station
- Unique longitude (normalized):
/unique?column=Longitude
To install dependencies:
bun install
To run:
bun run index.ts
This project was created using bun init
in bun v1.2.13. Bun is a fast all-in-one JavaScript runtime.