An open API service indexing awesome lists of open source software.

https://github.com/sanogotech/perfpythonfastapi


https://github.com/sanogotech/perfpythonfastapi

fastapi performance python rest-api

Last synced: 5 months ago
JSON representation

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