diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/FastAPI Example/Example.py b/FastAPI Example/Example.py new file mode 100644 index 0000000..8bd771c --- /dev/null +++ b/FastAPI Example/Example.py @@ -0,0 +1,23 @@ +from fastapi import FastAPI +from fastapi.responses import HTMLResponse + +app = FastAPI() + + +# Simple Endpoint +@app.get("/") +def read_root(): + return {"Hello": "World"} + +# Simple GET Endpoint +@app.get("/items") +def read_item(item1, item2, item3): + return {"item1": item1, + "item2": item2, + "item3": item3} + +# Simple Endpoint with HTML Response +@app.get("/html") +def read_html(): + html = """Welcome""" + return HTMLResponse(content=html, status_code=200) diff --git a/FastAPI Example/gunicorn.conf.py b/FastAPI Example/gunicorn.conf.py new file mode 100644 index 0000000..1a1799d --- /dev/null +++ b/FastAPI Example/gunicorn.conf.py @@ -0,0 +1,3 @@ +bind = "127.0.0.1:8081" +workers = 1 +worker_class = "uvicorn.workers.UvicornWorker"