📝 Add docs for using the Starlette Request directly (#25)

Add docs for using the Starlette Request directly
This commit is contained in:
euri10
2019-02-16 09:44:56 +01:00
committed by Sebastián Ramírez
parent 293ebd7cc2
commit febf8e7341
4 changed files with 66 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
from fastapi import FastAPI
from starlette.requests import Request
app = FastAPI()
@app.get("/items/{item_id}")
def read_root(item_id: str, request: Request):
client_host = request.client.host
return {"client_host": client_host, "item_id": item_id}