From c966bef31a329c1a0b0083424a71e0e8b171ac34 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 1 Aug 2021 13:44:06 +0200 Subject: [PATCH] Minimal fastapi api to test redirects --- main.py | 42 ++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ 2 files changed, 44 insertions(+) create mode 100755 main.py create mode 100644 requirements.txt diff --git a/main.py b/main.py new file mode 100755 index 0000000..292f4fc --- /dev/null +++ b/main.py @@ -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, + } + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..97dc7cd --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi +uvicorn