This is a simple video storage API that implements a functions listed below:
- Create a user
- Get user's information
- Update user's information
- Delete a user
To quick launch the production version we use the Docker container on a python3.11 image. The API production server listens to a 8080 port.
For building an image at the first time:
make build
make stop
make start
FastAPI automatically generates API documentation that is interactive, making it easy to test an API directly from the documentation page: http://localhost:8080/docs.
According to StackOverflow analysis, Python is one of the fastest-growing programming languages nowadays. More and more libraries are being developed for a wide variety of needs. This makes Python a great tool for solving a wide range kinds of problems.
FastAPI is a modern, fast, and easy-to-use web framework for building APIs with Python. It is gaining popularity in the Python community due to its performance, simplicity, and developer-friendly approach.
Fast Performance
FastAPI is built on top of the Starlette web framework and uses Pydantic for request and response data validation. This combination makes it incredibly fast and efficient. According to benchmarks, FastAPI can handle more than 50,000 requests per second, which is faster than most Python web frameworks.
Easy to Learn and Use
FastAPI has a very intuitive and easy-to-use API, making it easy for developers to get started quickly. It comes with a comprehensive and well-documented user guide that covers all the essential features of the framework. Additionally, it uses type hints to ensure that your code is easy to read and understand.
Automatic API Documentation
FastAPI automatically generates API documentation based on your code's type hints and function signatures. This feature makes it easy to understand how your API works, what parameters it accepts, and what responses it returns. The generated documentation is interactive, making it easy to test your API directly from the documentation page.
Robust Features
FastAPI comes with many useful features out-of-the-box, such as data validation, request parsing, response serialization, and more. It also supports WebSocket APIs, background tasks, and file uploads, making it a versatile framework for building APIs.
Scalable Architecture
FastAPI uses ASGI, a standard for asynchronous web servers and applications, making it highly scalable. It can handle multiple requests concurrently, making it an ideal choice for building high-performance APIs that can handle large traffic volumes.
For developing purpose we should run pipenv install
for dependency managing.
Then from the application root directory run:
./bootstrap.sh
Developing server works on 8000 port: http://localhost:8000/docs
There are unit tests within the directory tests, which testing endpoints. For testing run from a project root:
pytest -v tests/