A lightweight Express server that proxies requests to the Tova Cities API, keeping your API key safely on the server side.
This proxy forwards requests from your frontend to the Tova Cities API, injecting your API key via the X-API-Key header so it never gets exposed to the browser. CORS is enabled for easy local development.
| Route | Description |
|---|---|
GET / |
Health check (returns { status: "ok" }) |
GET /api/cities/search?q=...&iso3=... |
Search cities by name within a country (iso3 required; also supports n, contains) |
GET /api/cities/:ucc |
Get a city by its UCC |
GET /api/countries/:iso3 |
Get country info by ISO3 code |
GET /api/nearest?lat=...&lon=... |
Find nearest cities (supports n, imp params) |
- Install dependencies:
npm install- Create your
.envfile from the example:
cp .env.example .env-
Open
.envand replaceyour_api_key_herewith your actual Tova API key. -
Start the server:
npm startThe server will start on http://localhost:3000 (or the port specified in your PORT env var).
Sign up for a free API key at tovaapis.com.
Full endpoint docs are available at tovaapis.com/Docs/Cities.