Skip to content

greatjapa/five-0

Repository files navigation

Five-0

Build Status license

The word five-0 is a skateboard trick. I'm a huge fan of skateboarding and when I started to develop open source projects, I decided to use skate tricks as project names.

Introduction

The image bellow shows the five-0 architecture. Basically, five-0 is a microservice that read information from elasticsearch and make available through HTTP endpoints:

architecture

The sample data stored into elasticsearch is shown down below:

sample

How to build

$ git clone https://github.com/greatjapa/five-0.git
$ cd five-0
$ make up
$ make load

How to run

The make up command build the microservice code with maven and raise a docker container with it. As database, we use elasticsearch (see docker-compose.yml):

Five-0 has 2 endpoints:

  • GET /connection?city=\<city\>&depth=\<depth\>

As an example, you can try:

curl http://localhost:8080/connection?city=Rio%20de%20Janeiro

and the result will be:

[
    {
        "city" : "Belo Horizonte",
        "steps" : 0
    },
    {
        "city" : "São Paulo",
        "steps" : 0
    },
    {
        "steps" : 1,
        "city" : "Campinas"
    },
    {
        "city" : "Trindade",
        "steps" : 2
    }
]

you also may define a max depth as argument:

curl http://localhost:8080/connection?city=Rio%20de%20Janeiro&depth=2

the result is:

[
    {
        "city": "Belo Horizonte",
        "steps": 0
    },
    {
        "city": "São Paulo",
        "steps": 0
    },
    {
        "city": "Campinas",
        "steps": 1
    }
]
  • GET /time?city=\<city\>

The following example shows how this endpoint works:

curl http://localhost:8080/time?city=Rio%20de%20Janeiro

the result is:

[
    {
        "city": "Belo Horizonte",
        "time": 2.29
    },
    {
        "city": "São Paulo",
        "time": 5.19
    },
    {
        "city": "Campinas",
        "time": 9.89
    },
    {
        "city": "Trindade",
        "time": 19.75
    }
]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published