Рет қаралды 30,573
In this django rest api tutorial you will learn about rest api design and build one using the django rest framework. This episode is intended to give you a high-level overview of how the basic request-response cycle works, both with and without AJAX.
7 Tips For Getting Better At Django:
mailchi.mp/dea...
Github repository for this tutorial series:
github.com/The...
Traditionally, we reload a page, which sends a request to a url on the server. On there, we check whether that url exists, and if it does, we return a response which, most times, contains an HTML page with embedded CSS and JavaScript. Oftentimes, this approach is completely fine and just what you need!
On the other side, we can build a REST API which has url endpoints that can be used to either GET, POST, DELETE or PUT (update) data. Most times, this affects a database. The request is sent with JavaScript (in the case of a web application) or any other language if you're building for mobile/desktop, as pretty much all modern languages support the file format JSON.
With this approach, we have to still load an initial page, but from that point on, we can send asyncronous requests to a REST API and, for example in the case of a GET request, use the data to make a change on our webpage without having to reload it (that's how you build single-page applications).
Anyway, I hope this shines some light on the dark!
If you enjoyed this video, make sure to subscribe and share it with anyone you think could enjoy it as well.
I hope to see you inside of the next episode,
Cheers.