Design a RESTful API which can collect the information on the different locations for us and also determine the distance between the locations and a configurable location which can be changed or supplied. The formula for calculating distance between two points can be gotten here https://en.wikipedia.org/wiki/Great-circle_distance.
https://documenter.getpostman.com/view/6765162/TzeZES2H
Ensure you have the following installed on your local machine:
-
Make sure you have
nodejs
,postgres
installed. -
install nestJs global
- npm i -g @nestjs/cli
-
Clone or fork repo🤷♂
- git clone https://github.com/RIDUMATICS/finderly-api.git - cd finderly-api - npm install
-
Create a PostgreSQL database by running the command below in
psql
createdb -h localhost -p 5432 -U postgres finderly_db
-
Create/configure
.env
environment with your credentials. A sample.env.example
file has been provided to get you started. Make a duplicate of.env.example
and rename to.env
, then configure your credentials. -
Run
npm run start:dev
to start the server and watch for changes
- Run
npm run test
to performs a single full test suite run
URI | HTTP Method | Description |
---|---|---|
/api/v1/locations |
POST |
Create a new location |
/api/v1/locations |
GET |
Fetch all locations |
/api/v1/locations/:id |
GET |
Fetch a single location by id |
/api/v1/locations/distance?locationA=New York&locationB=London |
GET |
Calculate distance |
/api/v1/locations/:id |
UPDATE |
Update a single location by id |
/api/v1/locations/:id |
DELETE |
Delete a single location by id |
If for some reason you find this repo useful, please give me a star🙏