Introduction to FastAPI
00:00 In this lesson, you will learn what FastAPI is and how it relates to other web technologies in the Python ecosystem of packages. First, you should know that FastAPI is written with creating REST Web APIs in mind.
00:37 A REST API repurposes the existing HTTP methods to implement the four standard CRUD operations of a database. REST maps the HTTP methods—POST, GET, PUT, and DELETE—to the CRUD functions—create, read, update, and delete—respectively. And it also repurposes HTTP status codes.
01:03 A REST API is accessed using an HTTP endpoint, conceptually a web address. You are viewing this course on a page hosted on www.realpython.com, followed by a path corresponding to the course in question.
01:51 FastAPI makes it easy to create REST Web APIs. It is straightforward and does not include a lot of ceremony that other frameworks burden you with. It’s super fast, rivaling other web frameworks, such as node.js and Go. The reduced code you have to write lets you create APIs that have fewer errors while taking less time to develop.
02:14 And finally, it relies upon standards such as OpenAPI and JSON Schema and the latest Python features like type hinting. It even provides async support, but you don’t have to get into the weeds of the Python asyncio library.
02:32 You might be asking, why another framework for APIs? After all, we have the Django REST framework, Flask-RESTful, and others. It will become clear after you see the demos, but here are some spoilers.
02:45 As mentioned before, FastAPI was designed with REST APIs in mind. Django is designed to create information delivery forms over data web applications, not APIs. If you were using Django REST Framework, creating an API require some acrobatics that make it feel as if you were writing a Django web application instead of a REST API.
03:19 But if you don’t have an investment in Django already, you may have to learn things that might seem confusing. In the next lesson, you’ll learn about a free online development tool called Replit that you can use to develop the demo.
Become a Member to join the conversation.