Tech Stack
Django, Flask, Docker, PostgreSQL, Kafka
It demonstrates two separate conternized apps by docker. One of them is Django, and the other one is Flask, which they can communicate by a message broker (Kafka). For instance, here, the concept is that Django is the backend which the user creates, updates, or deletes posts via its endpoint API, then the Flask app calculates and finds out the related posts, and it saves them in its database separately. To retrieve the posts with their related posts, you have to call the Flask endpoint API.
-
These TCP ports must be free in the Host machine. 2181, 9092, 5434, 5433, 8000, 5000
-
Docker and docker-compose must be installed.
First, convert .env.example
to .env
then, In the main folder for the first time, run docker-compose up --build
.
After that, you can run it only by docker-compose up
.
- 127.0.0.1:8000/api/posts :
with GET method: retrieves all posts
with POST method: makes a new post, the requests must be included a JSON formatted body with title, slug, body, image
- 127.0.0.1:8000/api/post/{slug} :
with GET method: retrieves the single post with the {slug}
with DELETE method: deletes the post
with PUT method: it updates the post
- 127.0.0.1:5000/posts :
GET method: It returns all posts with the related attribute for every post