TheFastOrg / Backend

Apache License 2.0
0 stars 0 forks source link

Created RESTful API for MVP #2

Closed mhd-medfa closed 1 year ago

mhd-medfa commented 1 year ago

Today, we worked on creating a RESTful API for a restaurant review MVP using Django and Django Rest Framework. We started by creating models for the different entities such as users, restaurants, reviews, business info, and review likes. We then created serializers for these models to handle the data conversion between the API and the database. We also created views for handling the different CRUD operations for each of the models, and then used the DefaultRouter class from the rest_framework.routers module to register these views and create the URLs for the API. We also made sure that the views were compatible with the DefaultRouter class by using viewsets instead of views. Finally, we imported the views in the project's urls using the include function from the django.urls module.

We also covered some other important topics such as creating a database for the project, handling csrf verification failed, and creating a decorator for the admin panel.

Overall, we were able to create a fully functional RESTful API for the restaurant review MVP, with all the necessary CRUD operations and a clean and organized structure for the code.