Building simple microservices with Python
https://dev.to/paurakhsharma/microservice-in-python-using-fastapi-24cc
Running on docker using docker-compose
$ sudo docker-compose up -d
by default this project using vertualenv
so first, setup env.
$ virtualenv env
# activate `virtualenv`
$ source ./env/bin/activate
# install pip requirements
$ pip install -r requirements.txt
Start development server
$ uvicorn app.main:app --reload
curl --request POST \
--url http://localhost:8080/api/v1/casts \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"name":"Ryan Aunur","nationality":"Indonesia"}'
curl --request POST \
--url http://localhost:8080/api/v1/movies \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"name":"Iron Man: 1","plot":"This is dummy plot","genres":["Action","Adventure","Fantasy"],"casts_id":[1]}'
curl --request GET \
--url http://localhost:8080/api/v1/movies \
--header 'accept: application/json'