Simple BE for buying items and showing all bought items - using MongoDB Kafka and Python flusk
Clone the repo and run
docker-compose -f docker-compose.yaml up
webserver api is accessible on port 5000
"buy" an item by sending the api
POST /buy
username
userid
price
timestamp
For example:
curl http://localhost:5000/buy -d '{ "username": "AvivT", "userid": "cdj_ks7393cs", "price": "25.6", "timestamp": "67832804329" }'
GET /allBuys
For example:
curl http://localhost:5000/allBuys
.
├── customer-management
│ ├── api.py >>> api for internal use - called by webserver api
│ ├── consumer.py >>> kafka consumer code
│ ├── Dockerfile
│ └── start.sh >>> helper script to allow running both processes - api server and consumer
├── customer-webserver
│ ├── api.py >>> api exposed to user
│ └── Dockerfile
└── docker-compose.yaml
- Support more than one user - getting all db entries matching a requested id (/allBuys?)
- change default db user password and be used as env vars instead of hardcode
- kafka should be configured as cluster, think about # of partitions