mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-25 07:08:11 -05:00
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."})
|