/geocoding

A RESTFUL API built with Express and TypeScript. It must receive three or more addresses and return some useful information about their coordinates and distances.

Primary LanguageTypeScript

🌐 Closer | Geocoding API


Synopsis:

Ever wondered how far away you are from your friends or even that amazing japanese restaurant you want to visit? Ever had to decide who was the most suitable person for that last moment trip to the market? Well, no more. With Closer, you can rest assure that all that information is merely one click and one address away.

The closer the better!

Description:

Closer is a project developed in TypeScript, in the Node + Express ecosystem. Through a RESTful API, it receives three or more addresses and proceeds to process them, calculating the distances between each one. It returns you a list of the distances between each pair of locations, and also the closest and farthest pair.



Want to check it out by yourself?

🧠 Project Responsabilities:

  • Connect with an external service through an API
  • Receive three addresses and get their coordinates
  • Calculate the distance between each pair of addresses
  • Highlight both the nearest and farthest distances in the array
  • Assure code quality and maintenability through unit tests coverage.

🔥 The Extra Mile:

  • Configure project from scratch with TypeScript
  • Use the MVC model for maintaining good code practices
  • Configure .env for using a restrict API, without exposing sensible data
  • Documenting the application through Swagger
  • Deploying the application to Heroku for a smoother testing experience

🧰 Technologies:

  • TypeScript
  • NodeJS
  • ExpressJS
  • Google Geocoding API
  • Axios
  • Jest

🎯 Endpoints:

  • GET /distances: Receives the query param "addresses", which is a string of addresses separated by ';'. It then returns a list of the distances between those addresses, as well as the farthest and nearest ones.

💻 How to use it:

For running this project, you will need to have Node installed and a valid Google API key for using their Geocoding API.

For the project to connect with the geocoding API, you will need to have a .env file with the following line:

API_KEY=<your_google_api_key_here>

After that, you're all set. Run yarn for installing the dependencies and yarn dev for running the project. For running the tests, a simple yarn test will do the trick as well.

Good hacking! 👊 🔥