Conteúdo do Curso
Professional Web API with Flask
Professional Web API with Flask
Swagger UI
One more convenient built-in tool that assists in documenting our API is Swagger. Thanks to Swagger, we can easily describe the structure and functionality of our application. To integrate Swagger, a few additional configuration parameters need to be specified in the create_app() function within the app.py file.
First, we specify the path where we can find the documentation:
Second, we indicate the URL for the Swagger UI:
Now, let's navigate to our application in the browser and go to /swagger-ui to explore our documentation and test it. We see that all endpoints are listed. As we develop new endpoints, our documentation will automatically update. We can test our endpoints just as we did in Postman, the only difference being that we cannot save requests for repeated testing.
Excellent, we have enriched our knowledge with the skill to use another tool.
Note
The link lets you compare your code with the project's code on GitHub.
Obrigado pelo seu feedback!