Minimal fastapi api to test redirects

This commit is contained in:
Peter J. Holzer 2021-08-01 13:44:06 +02:00 committed by Peter J. Holzer
commit c966bef31a
2 changed files with 44 additions and 0 deletions

42
main.py Executable file
View File

@ -0,0 +1,42 @@
from fastapi import FastAPI
app = FastAPI()
@app.get("/f1")
async def f1():
return {
"name": "f1",
"slash": False,
}
@app.get("/d1")
async def f1():
return {
"name": "d1",
"slash": False,
}
@app.get("/d1/f2")
async def f1():
return {
"name": "f2",
"slash": False,
}
@app.get("/d2/")
async def f1():
return {
"name": "d2",
"slash": True,
}
@app.get("/d2/f3")
async def f1():
return {
"name": "f3",
"slash": False,
}

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
fastapi
uvicorn