FASTAPI
What is FastAPI?
FastAPI is a modern Python framework used to build high-performance APIs and backend applications quickly and with less code
ASGI vs WSGI
Both WSGI and ASGI are standards that define how a Python web application communicates with a web server.
Think of them as a bridge between your Python code and incoming web requests.
WSGI (Web Server Gateway Interface)
WSGI is the older standard used by frameworks like:
- Flask
- Django (traditional mode)
Characteristics
✅ Simple
✅ Stable
✅ Good for traditional web applications
❌ Handles one request at a time (synchronous)
Get Reema Kumaritech’s stories in your inbox
Join Medium for free to get updates from this writer.
❌ Not ideal for WebSockets and real-time apps
ASGI (Asynchronous Server Gateway Interface)
ASGI is the modern successor to WSGI.
Used by:
- FastAPI
- Starlette
- Django (async support)
Characteristics
✅ Supports Async/Await
✅ Supports WebSockets
✅ High Performance
✅ Handles thousands of concurrent requests
✅ Perfect for AI applications
the ASGI is implemenented by uvicorn server
so we need to install it first with fastapi
pip install uvicornimport uvicorn
from fastapi import FastAPI
app=FastAPI()
@app.get("/")
def root():
return "hello world!"
@app.get("/HomePage")
def root2(name:str):
return {"my name is " : {name}}
if __name__=='__main__':
uvicorn.run(app, host="127.0.0.0", port=8000)



