Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Latest commit

 

History

History
64 lines (49 loc) · 2.45 KB

SOLUTION.md

File metadata and controls

64 lines (49 loc) · 2.45 KB

Notes

Each microservice has a README file containing useful information about the development environment and the implementation:

Also, there are some helpful comments in the code. Maybe they can be a topic for future improvements.

Before pushing any commits to this repo I do:

The Caveats

  • All microservices run under HTTP connection and it would be nice to switch to HTTPS. Even microservices inside private VPC subnets shouldn't expose unencrypted endpoints. Let's assume for now that we keep that in mind and will take care about DevOps issues a bit later.
  • I use elixir_nsq library as NSQ client that communicates with a queue via TCP and it's a bit odd. But it seems to be the best option for now in Elixir.

Running Tests

  • On majority of projects I use Circle CI with following configs. It runs linters, security cheks, tests, and also pushes test coverage results to coveralls.io.
  • I put mix test command in Makefile and assume that you have installed Elixir on CI instance.

Testing Endpoints / Manual Testing

## Send locations to Gateway server
curl -X "PATCH" "http://localhost:4000/drivers/1/locations" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "longitude": "3.350498",
  "latitude": "58.864193"
}'

## Request information about driver's locations
curl "http://localhost:4001/drivers/1/locations"
curl "http://localhost:4001/drivers/1/locations?hours=1"
curl "http://localhost:4001/drivers/1/locations?minutes=1"
curl "http://localhost:4001/drivers/1/locations?seconds=10"

## Request information about driver
## Forwards the HTTP request to the Zombie Driver service
curl "http://localhost:4000/drivers/1" # => true

## Send locations to Gateway server
curl -X "PATCH" "http://localhost:4000/drivers/1/locations" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "longitude": "2.350498",
  "latitude": "48.864193"
}'

## Request information about driver
## Forwards the HTTP request to the Zombie Driver service
curl "http://localhost:4000/drivers/1" # => false