Created
March 21, 2023 00:57
-
-
Save merrymercy/d7309af801dd3cfcb4f895368fd3dffa to your computer and use it in GitHub Desktop.
Permanently redirect to another url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from starlette.responses import RedirectResponse | |
app = FastAPI() | |
@app.get("/") | |
async def redirect(): | |
response = RedirectResponse(url="https://alpa-projects.github.io/opt", status_code=301) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment