Locations API from Tanzania locations repository.
Inspired by Mtaa API which was built using python & locations from a JSON file.
This is built using Prisma, NestJs & Postgresql database.
Create file .env
then copy variables in sample.env
You need to provide Postgresql environment in enviroment file .env
# install dependencies
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
You can access this API using any Http Request tool (ie. Postman, Httpie, curl etc)
Available locations
- Countries
-
Get all countries
- Regions
-
Get all regions
-
Get specific region (By postcode)
-
Get specific region (By Name)
-
The same applies to Districts, Wards & Places
-
Search (POST request)
https://locations.webongo.services/search searchText=n
(n.length >= 3)
-
Whatever you query by id (Regions, Districts, Wards, Places)
you get it's discending location roots using Prisma relations.
The syntax is the same for other objects
Replace regions
with districts
, wards
& places
to get the specific
location you want.
Get all regions
curl https://locations.webongo.services/regions
Get all districts
curl https://locations.webongo.services/districts
Get all wards
curl https://locations.webongo.services/wards
Get all places -> May be a bit slow & big bodied ;-)
curl https://locations.webongo.services/places
Search a Location
curl -X POST -d 'searchText=mtakuja'
https://locations.webongo.services/search