From 569589a4f52edd4f91c4a7bc77c64aeb72f3c105 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 26 Jan 2025 13:24:46 +0100 Subject: [PATCH] add Setup Test --- .gitignore | 3 ++- HelloWorld.db | Bin 0 -> 12288 bytes README.md | 11 +++++++++-- index.html | 26 ++++++++++++++++++++++++++ main.py | 26 ++++++++++++++++++++++++++ requirements.txt | 2 ++ 6 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 HelloWorld.db create mode 100644 index.html create mode 100644 main.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index e928de1..f9b1113 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] -*$py.class \ No newline at end of file +*$py.class +/env \ No newline at end of file diff --git a/HelloWorld.db b/HelloWorld.db new file mode 100644 index 0000000000000000000000000000000000000000..6903412057fecbff70602ce33ccca95937c1ef79 GIT binary patch literal 12288 zcmeI&ze~eF6bJCTL==k}w~l$>($eDMprcU^4Ysky6U`*io*|GQw2AJn`p-)L0$(c) z*u~lMedLmR$Ge03Y!7mKGe~PgFXc3kYdRA9LP~K;B!sYd*gTdYd9txg_&d-43QHWm zeeQCV<(vrTgI@>;KmY;|fB*y_009U<00Izzz&{cgS)1)%Peyh8l$mOhaTEPmnaQgu zo>x=*JXD@mq`k9&qLtcC5$C4QJG-^qYP+s{KVBS}OpU42BB`2*_3M~snK~`vNXO&{ zT3x7+Mxj6S!icU^MBbgg_5 + + + + + Setup Test + + +

Not Working

+ + + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..4020ace --- /dev/null +++ b/main.py @@ -0,0 +1,26 @@ +import sqlite3 +from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware +import uvicorn + +app = FastAPI() +# Allow CORS for all origins (for simplicity) +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + + +@app.get("/greetings") +async def get_greetings(): + connection = sqlite3.connect("HelloWorld.db") + cursor = connection.cursor() + cursor.execute("SELECT * FROM greetings") + rows = cursor.fetchall() + return {"greetings": rows} + +if __name__ == "__main__": + uvicorn.run(app, host="127.0.0.1", port=8000) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f0615cf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +fastapi +uvicorn \ No newline at end of file