FastAPI Tutorial

Publicado em: 16 Janeiro 2022
no canal de: microapis
3,100
104

In this video, Jose Haro Peralta explains how to build a simple API with Python's popular FastAPI framework.

You'll learn to build a simple TODO API to manage tasks. With this API, you can create a task, update it, and delete it.

0:00 Introduction
00:22 Setting up the environment and installing dependencies
01:26 Introducing the API specification (TODO API)
02:50 Creating a FastAPI application
03:25 Implementing the validation models with Pydantic
09:41 Implementing the API endpoints
11:05 Implementing GET /todo
12:10 Implementing POST /todo
16:10 Implementing GET /todo/{todo_id}
18:18 Implementing PUT /todo/{todo_id}
21:04 Implementing DELETE /todo/{todo_id}
23:26 Running FastAPI with Uvicorn
24:07 Loading the API views
24:50 Fixing the CreateTaskSchema
25:18 Testing the API with FastAPI's Swagger UI
27:13 Wrapping up

FastAPI is a high-performant REST API framework for Python. It's built on top of Starlette (https://www.starlette.io/) and it uses Pydantic (https://pydantic-docs.helpmanual.io/) for data validation. It can generate OpenAPI documentation from your code and also produces a Swagger UI that you can use to test your application.

Check out FastAPI's official repository (https://github.com/tiangolo/fastapi) and give it a star! Also make sure to check out its excellent documentation online: https://fastapi.tiangolo.com/.

The link to Swagger UI's editor mentioned in the video is this: https://editor.swagger.io/.

The code for this tutorial is available in the following GitHub repository: https://github.com/abunuwas/simple-fa.... I'd appreciate if you give it a star! Also feel free to fork out the repo.

REST APIs are documented with the OpenAPI documentation standard. You can learn more about OpenAPI in its official website: https://www.openapis.org/.

During the video, I make a reference to OpenAPI links. You can learn more about this concept from this segment from my 2021 EuroPython conference:    • Jose Haro Peralta - Documentation-driven d...  .

Check out my 2021 EuroPython presentation to learn more about API testing:    • Jose Haro Peralta - Documentation-driven d...  .

If you liked this video, please like it and share it with your network! You can also subscribe to my channel! All this goes a long way to supporting me to continue creating this kind of content.

I'm also the author of Microservice APIs with Examples in Python. It's a book dedicated to explaining how to design and build microservices and APIs, with examples in Python. If you're interested in the book, you can get a copy through this link: http://mng.bz/jy4x. Feel free to use the following code to get a 40% discount: slperalta (reach out to me if you have issues using the code).

You can also download two chapters of the book for free from this link: https://www.microapis.io/resources/mi...

Please let me know in the comments if you liked this video and whether you found it useful.

Let me know also what other kinds of topics you'd like me to address in future videos!


Nesta página do site você pode assistir ao vídeo on-line FastAPI Tutorial duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário microapis 16 Janeiro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 3,100 vezes e gostou 104 espectadores. Boa visualização!