aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-05 18:46:08 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-05 18:46:08 +0530
commit167befc8ed6fd8e327b4554f6716bbc1d7f3531b (patch)
tree41f38a0c6d794c4e975328acce99f6ea5decbc7c /app
parentf8b29478f5481b39225d77b630049f759a572ce7 (diff)
added FastAPI support
Diffstat (limited to 'app')
-rw-r--r--app/apis.py9
-rw-r--r--app/tests/test_fastapi.py10
2 files changed, 19 insertions, 0 deletions
diff --git a/app/apis.py b/app/apis.py
new file mode 100644
index 0000000..df6ddd1
--- /dev/null
+++ b/app/apis.py
@@ -0,0 +1,9 @@
+from api import app
+
+from fastapi import Body, FastAPI
+from fastapi.middleware.wsgi import WSGIMiddleware
+from pydantic import BaseModel
+
+@app.get("/version")
+async def API_Version():
+ return {"message":app.version} \ No newline at end of file
diff --git a/app/tests/test_fastapi.py b/app/tests/test_fastapi.py
new file mode 100644
index 0000000..c6b40cc
--- /dev/null
+++ b/app/tests/test_fastapi.py
@@ -0,0 +1,10 @@
+from starlette.testclient import TestClient
+
+from api import app as fastapi_app
+
+fastapi_client = TestClient(fastapi_app)
+
+def test_fastapi(app, client):
+ res = fastapi_client.get("/version")
+ assert res.status_code == 200
+ assert res.json() == {"message":fastapi_app.version} \ No newline at end of file