Mapping CRUD operations to HTTP methods
Basically, data processing is about creating, reading, updating, and deleting data as it converges in the CRUD acronym. The address-matching microservice from our sample microservices application will add addresses to the Subscription
database. We have two options to set up the microservice for this:
- Let the microservice update the database directly through the
pymongo
Python package or Django ORM. - Engage a Web API, which updates the database, and let the microservice call that Web API.
Since Django ORM is easier to apply than a pymongo – MongoDB connection, we prefer Django ORM within option 1. We still choose option 2, the Web API, because a Web API better aligns with the microservices architecture where the components should be self-contained, single-tasked, and independent.
Choosing the Web API option means we’ll build a RESTful API with DRF to handle the data processing. And this requires us to map CRUD...