Skip to content

Live Tanzania πŸ‡ΉπŸ‡Ώ locations API πŸ”₯

License

Notifications You must be signed in to change notification settings

HackEAC/locations-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ac987f5 Β· Dec 15, 2022

History

43 Commits
Aug 27, 2021
Dec 15, 2022
Apr 24, 2021
Apr 24, 2021
Aug 27, 2021
Apr 24, 2021
Jul 1, 2021
Aug 28, 2022
Apr 24, 2021
Aug 27, 2021
Sep 22, 2021
Apr 24, 2021
Apr 24, 2021

Repository files navigation

Description

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.

Setup

Create file .env then copy variables in sample.env

You need to provide Postgresql environment in enviroment file .env

Running the app

# install dependencies
$ npm install

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Access API

You can access this API using any Http Request tool (ie. Postman, Httpie, curl etc)

Available locations

  1. Countries
  1. Regions
  1. The same applies to Districts, Wards & Places

  2. Search (POST request)

    https://locations.webongo.services/search searchText=n

    (n.length >= 3)

  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.

Live Examples

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

Credits