pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
11 lines
352 B
11 lines
352 B
from fastapi import FastAPI, Response
|
|
from fastapi.responses import RedirectResponse
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/portal")
|
|
async def get_portal(teleport: bool = False) -> Response | dict:
|
|
if teleport:
|
|
return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
return {"message": "Here's your interdimensional portal."}
|
|
|