A simple microservices application demonstrated with Nameko
You will need docker-compose and docker installed in order to run the application. Refer to the relevant documentation for each.
Also, you will need to have virtualenv or pipenv installed.
Running the application:
docker-compose upTest the running application with:
$ curl -i -d "{\"airport\": \"first_airport\"}" localhost:8000/airport
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 32
Date: Sun, 27 May 2018 05:05:53 GMT
f2bddf0e506145f6ba0c28c247c54629Query the newly created airport
$ curl localhost:8000/airport/f2bddf0e506145f6ba0c28c247c54629
{"airport": "first_airport"}Great, now let’s add another airport:
$ curl -i -d "{\"airport\": \"second_airport\"}" localhost:8000/airport
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 32
Date: Sun, 27 May 2018 05:06:00 GMT
565000adcc774cfda8ca3a806baec6b5Now we got two airports, That’s enough to form a trip. Let’s create a trip now:
$ curl -i -d "{\"airport_from\": \"f2bddf0e506145f6ba0c28c247c54629\", \"airport_to\": \"565000adcc774cfda8ca3a806baec6b5\"}" localhost:8000/trip
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 32
Date: Sun, 27 May 2018 05:09:10 GMT
34ca60df07bc42e88501178c0b6b95e4As before, that last line represents the trip ID. Let’s check if it was inserted correctly:
$ curl localhost:8000/trip/34ca60df07bc42e88501178c0b6b95e4
{"trip": "{'from': 'f2bddf0e506145f6ba0c28c247c54629', 'to': '565000adcc774cfda8ca3a806baec6b5'}"}