https://github.com/sanogotech/perfpythonfastapi
https://github.com/sanogotech/perfpythonfastapi
fastapi performance python rest-api
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sanogotech/perfpythonfastapi
- Owner: sanogotech
- Created: 2020-07-24T06:56:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-07T14:29:36.000Z (almost 5 years ago)
- Last Synced: 2025-06-10T14:49:43.739Z (7 months ago)
- Topics: fastapi, performance, python, rest-api
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PerfPythonFastAPI
## Docs
- https://fastapi.tiangolo.com/async/
- https://morioh.com/p/78598efe32b5
## Install
```
pip install fastapi
pip install uvicorn
```
You will also need an ASGI server, for production such as Uvicorn or Hypercorn.
## Code "main.py"
```
from typing import Optional
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
return {"item_id": item_id, "q": q}
```
## Run the server
uvicorn main:app --reload
## API
- http://127.0.0.1:8000/items/5?q=somequery
- http://127.0.0.1:8000/docs