DEV Community

Abhijith Ganesh
Abhijith Ganesh

Posted on

What does it take to build an unconventional REST API in Python?

What is this about?

This is my first article/post on https://dev.to. So I would appreciate all suggestions and tips relevant to my article . Now diving into the topic.

Let us say, you are assigned for a project and now you need to make an API along with a Django backend. It needs to be RESTful in nature and your goal is speed. What would an ideal solution be?(Graphene and related integration pertinent to GraphQL can be done, I might do it in the future and when I do, I shall update the community with another post) Most likely, everyone from your seniors to google would suggest Django-REST-Framework because it is more convenient and more widely used.
But then why should you consider this option?

Reasons why you must give it a chance:

  • Speed:

  • I know Python and Django are usually criticized for their speeds but FastAPI promises us something different. As such it is flexible, fast and intuitive. It is easier to make an API if you know how to make REST-API methods in python. It is quite similar to writing methods in Flask. It might be a little bit of a stretch when you are starting out with the models because you might need to translate a few parameters using Pydantic. After this is set up, all API endpoints and all HTTP methods can be converted into functions in python seamlessly.

    It is a promising avenue where both rapid development and speed can be simultaneously achieved.

  • Power of a Strong and Solid Back-end:

  • With this project , One can quickly utilize the features provided by the Django Framework without any additional worries. Sessions, User-Authentication, ORM and all other salient features can be seamlessly integrated with the power of FastAPI resulting in the best of the two worlds. Apart from this, you get the Django-Admin Panel which grants access to essential/data of higher relevance and importance

    With little effort, One gets the best of the two worlds and a project which is truly reliable

  • Documentation:

  • One can access the Documentation for the App they've developed through by going to project-url/redoc and see an Open API documentation for the methods they've defined. Clearly an additional perk which will be helpful to all the stakeholders on the longer run.

    Conclusion

    This project was an amazing journey in my opinion and I believe it might be used in some future projects and I believe this exploration has satisfied my quest. Nevertheless one must keep experimenting like this and try bringing something new to the world.

    To learn about the technical aspects of the project visit
    Click Here

    And to view the deployment (The UI is not optimized for Mobile Devices)
    Click Here

    Top comments (0)