GithubHelp home page GithubHelp logo

routing's Introduction

Routing

Overview

The application finds a land route between two countries based on list of countries located at : https://raw.githubusercontent.com/mledoze/countries/master/countries.json. To calculate the route, list of each country borders (neighbourgh countries) from the above URL is used.

Upon start, the application exposes a single service, /routing/{origin}/{destination}, that allows to search for a route by country codes (cca3).
Results are returned as an array of codes of countries between (and including) origin and destination.

If land route between the countries does not exist, or if one of the country codes is not found, the application responds with HTTP status code 400 and a simple JSON object with details of the error.

Build and run

Build a WAR file

Using git and maven:

  1. git clone https://github.com/xalbrech/Routing.git.
  2. cd Routing
  3. mvn package
  4. The WAR is located in subdirectory target/.

Run from command line

On a checked-out project, run maven:

  1. git clone https://github.com/xalbrech/Routing.git
  2. mvn spring-boot:run
  3. Spring Boot starts a web container at local port 8080
  4. To test the application, open a new browser window and navigate to: http://localhost:8080/routing/CZE/ITA
  5. The service shall return: {"route":["CZE","AUT","ITA"]}

Source code

Important units of the source:

  • xalbrech.exercises.routing.map.CountryMap Loads and maintains the map data
  • xalbrech.exercises.routing.calculation.RouteCalculator Performs actual calculation of the route (uses a bfs to traverse the data provided by CountryMap)
  • xalbrech.exercises.routing.controller.RoutingController REST controller that defines the /routing endpoint.

routing's People

Contributors

xalbrech avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.