mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-24 06:39:31 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
12 lines
381 B
Python
12 lines
381 B
Python
from fastapi import FastAPI, Response
|
|
from fastapi.responses import JSONResponse, RedirectResponse
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/portal")
|
|
async def get_portal(teleport: bool = False) -> Response:
|
|
if teleport:
|
|
return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
|
|
return JSONResponse(content={"message": "Here's your interdimensional portal."})
|