Fastest python framework [FastAPI]
“The speed-oriented modern web framework”.
The FastAPI is not just only the fastest framework also has these features as a good framework.
- Fast to code: less code and very powerful to develop features. increases development speed by about 200% to 300%
- Intuitive: Has great editor support with very good auto-completion. Also, less time consumes for debugging.
- Easy: It is designed to be easy to learn also the documentation is really clear. So it takes less time for reading docs.
- Short: Reduces the code duplication and ensures fewer bugs.
- Robust: It gives production-ready code.
- Standards-based: It is based on OpenAPI and JSON schema.
FastAPI stands on the shoulders of two giants
Source from the official documentation
Let's get started with FastAPI
- Firstly we install fastapi.
pip install fastapi
2. We need an ASGI server, for production such as Uvicorn.
pip install uvicorn[standard]
3. Then we create main.py file with the following:
from fastapi import FastAPI app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
4. Run the server with uvicorn.
Now we can navigate to http://127.0.0.1:8000 and see the JSON response.
{"message":"Hello World!"}
That’s it!
That is a just start to FastAPI. Let’s talk more about FastAPI in the next articles.
Conclusion
We all see that how much FastAPI is beginner-friendly. It is really easy to get started and continue your projects. Make sure to share your thoughts about the FastAPI.
Thanks for reading :)