pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
422 B
15 lines
422 B
from fastapi import FastAPI, Request
|
|
from fastapi.route_middleware import log_route, route_middleware, verify_jwt
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.post("/secure")
|
|
@route_middleware(verify_jwt, log_route)
|
|
async def secure_route(req: Request, is_true: bool):
|
|
return {"status": "ok", "is_true": is_true, "user": req.user}
|
|
|
|
|
|
@app.post("/open")
|
|
async def open_route(is_true: bool):
|
|
return {"status": "open", "is_true": is_true}
|
|
|