From cde4d7cdf732083c0a8450f0dc7861d49f175e4c Mon Sep 17 00:00:00 2001 From: mervegrbz Date: Sun, 28 May 2023 16:55:42 +0300 Subject: [PATCH 1/5] delete volume of nginx --- practice-app/docker-compose.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/practice-app/docker-compose.yaml b/practice-app/docker-compose.yaml index c78661b2..bb84118b 100644 --- a/practice-app/docker-compose.yaml +++ b/practice-app/docker-compose.yaml @@ -12,11 +12,7 @@ services: - client networks: - practice-network - volumes: - # - ~/static:/static - - ~/staticFiles:/root/staticFiles restart: always - backend: build: context: ./server From aaa6f8b749972ff601820203385d9e9fee687270 Mon Sep 17 00:00:00 2001 From: mervegrbz Date: Sun, 28 May 2023 16:55:56 +0300 Subject: [PATCH 2/5] fix CORS error --- practice-app/client/pages/_document.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/practice-app/client/pages/_document.tsx b/practice-app/client/pages/_document.tsx index 54e8bf3e..be21f717 100644 --- a/practice-app/client/pages/_document.tsx +++ b/practice-app/client/pages/_document.tsx @@ -1,9 +1,13 @@ import { Html, Head, Main, NextScript } from 'next/document' + export default function Document() { return ( - + + + +
From 3d6b4cb45a77168382d9bfd8088fbf3f200b5ced Mon Sep 17 00:00:00 2001 From: mervegrbz Date: Sun, 28 May 2023 16:56:05 +0300 Subject: [PATCH 3/5] define root path --- practice-app/server/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/practice-app/server/Dockerfile b/practice-app/server/Dockerfile index 8f9882f8..a9d141cc 100644 --- a/practice-app/server/Dockerfile +++ b/practice-app/server/Dockerfile @@ -5,4 +5,4 @@ COPY requirements.txt . RUN pip3 install -r requirements.txt COPY . /app -CMD uvicorn main:app --host 0.0.0.0 --port 8000 +CMD uvicorn main:app --host 0.0.0.0 --port 8000 --root-path /api From 4300dab159285d6b5aeea7b58d672c260662d734 Mon Sep 17 00:00:00 2001 From: mervegrbz Date: Sun, 28 May 2023 16:56:18 +0300 Subject: [PATCH 4/5] add swagger endpoint --- practice-app/server/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/practice-app/server/main.py b/practice-app/server/main.py index 35782d33..49b39903 100644 --- a/practice-app/server/main.py +++ b/practice-app/server/main.py @@ -21,6 +21,14 @@ app = FastAPI() app.include_router(add_activity_app) +@app.get("/docs", include_in_schema=False) +async def custom_swagger_ui_html(req): + root_path = req.scope.get("root_path", "").rstrip("/") + openapi_url = root_path+ 'api/' + app.openapi_url + return get_swagger_ui_html( + openapi_url=openapi_url, + title="API", + ) app.add_middleware( CORSMiddleware, From a279990ad2f6d4e4c23b971c847efd247d75acf2 Mon Sep 17 00:00:00 2001 From: mervegrbz Date: Sun, 28 May 2023 16:56:29 +0300 Subject: [PATCH 5/5] change directory of frontend --- .../templates/add_action.html | 2 +- .../add_activity_api/templates/add_event.html | 2 +- .../add_activity_api/templates/add_need.html | 2 +- .../templates/add_resource.html | 2 +- .../templates/delete_action.html | 2 +- .../templates/delete_event.html | 2 +- .../templates/delete_need.html | 2 +- .../templates/delete_resource.html | 2 +- .../templates/get_action.html | 4 ++-- .../add_activity_api/templates/get_event.html | 4 ++-- .../add_activity_api/templates/get_need.html | 4 ++-- .../templates/get_resource.html | 4 ++-- .../add_activity_api/templates/index.html | 24 +++++++++---------- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/practice-app/server/add_activity_api/templates/add_action.html b/practice-app/server/add_activity_api/templates/add_action.html index e56694e5..2e71ccf5 100644 --- a/practice-app/server/add_activity_api/templates/add_action.html +++ b/practice-app/server/add_activity_api/templates/add_action.html @@ -149,7 +149,7 @@ object[key] = value; }); const json = JSON.stringify(object); - fetch('/addel/add/action', { + fetch('/api/addel/add/action', { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/practice-app/server/add_activity_api/templates/add_event.html b/practice-app/server/add_activity_api/templates/add_event.html index abdf696f..52c7fbc4 100644 --- a/practice-app/server/add_activity_api/templates/add_event.html +++ b/practice-app/server/add_activity_api/templates/add_event.html @@ -128,7 +128,7 @@ object[key] = value; }); const json = JSON.stringify(object); - fetch('/addel/add/event', { + fetch('/api/addel/add/event', { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/practice-app/server/add_activity_api/templates/add_need.html b/practice-app/server/add_activity_api/templates/add_need.html index 0aaa5bb6..76d0206a 100644 --- a/practice-app/server/add_activity_api/templates/add_need.html +++ b/practice-app/server/add_activity_api/templates/add_need.html @@ -132,7 +132,7 @@ object[key] = value; }); const json = JSON.stringify(object); - fetch('/addel/add/need', { + fetch('/api/addel/add/need', { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/practice-app/server/add_activity_api/templates/add_resource.html b/practice-app/server/add_activity_api/templates/add_resource.html index b3cc3a7d..a5b96748 100644 --- a/practice-app/server/add_activity_api/templates/add_resource.html +++ b/practice-app/server/add_activity_api/templates/add_resource.html @@ -132,7 +132,7 @@ object[key] = value; }); const json = JSON.stringify(object); - fetch('/addel/add/resource', { + fetch('/api/addel/add/resource', { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/practice-app/server/add_activity_api/templates/delete_action.html b/practice-app/server/add_activity_api/templates/delete_action.html index 2b41baf1..d6fd6337 100644 --- a/practice-app/server/add_activity_api/templates/delete_action.html +++ b/practice-app/server/add_activity_api/templates/delete_action.html @@ -6,7 +6,7 @@ -
+
diff --git a/practice-app/server/add_activity_api/templates/delete_event.html b/practice-app/server/add_activity_api/templates/delete_event.html index 5cb63fa4..2f041c19 100644 --- a/practice-app/server/add_activity_api/templates/delete_event.html +++ b/practice-app/server/add_activity_api/templates/delete_event.html @@ -6,7 +6,7 @@ -
+
diff --git a/practice-app/server/add_activity_api/templates/delete_need.html b/practice-app/server/add_activity_api/templates/delete_need.html index 4b1095a2..dcc4e5c0 100644 --- a/practice-app/server/add_activity_api/templates/delete_need.html +++ b/practice-app/server/add_activity_api/templates/delete_need.html @@ -6,7 +6,7 @@ -
+
diff --git a/practice-app/server/add_activity_api/templates/delete_resource.html b/practice-app/server/add_activity_api/templates/delete_resource.html index b792aaa5..aa1e45c7 100644 --- a/practice-app/server/add_activity_api/templates/delete_resource.html +++ b/practice-app/server/add_activity_api/templates/delete_resource.html @@ -6,7 +6,7 @@ -
+
diff --git a/practice-app/server/add_activity_api/templates/get_action.html b/practice-app/server/add_activity_api/templates/get_action.html index 3b492faf..792ed3dc 100644 --- a/practice-app/server/add_activity_api/templates/get_action.html +++ b/practice-app/server/add_activity_api/templates/get_action.html @@ -6,11 +6,11 @@ -
+
-
+
diff --git a/practice-app/server/add_activity_api/templates/get_event.html b/practice-app/server/add_activity_api/templates/get_event.html index f426cb50..c0e28363 100644 --- a/practice-app/server/add_activity_api/templates/get_event.html +++ b/practice-app/server/add_activity_api/templates/get_event.html @@ -6,11 +6,11 @@ -
+
-
+
diff --git a/practice-app/server/add_activity_api/templates/get_need.html b/practice-app/server/add_activity_api/templates/get_need.html index c8fad150..50a72b65 100644 --- a/practice-app/server/add_activity_api/templates/get_need.html +++ b/practice-app/server/add_activity_api/templates/get_need.html @@ -6,11 +6,11 @@ -
+
-
+
diff --git a/practice-app/server/add_activity_api/templates/get_resource.html b/practice-app/server/add_activity_api/templates/get_resource.html index 367950fe..2576d996 100644 --- a/practice-app/server/add_activity_api/templates/get_resource.html +++ b/practice-app/server/add_activity_api/templates/get_resource.html @@ -6,11 +6,11 @@ -
+
-
+
diff --git a/practice-app/server/add_activity_api/templates/index.html b/practice-app/server/add_activity_api/templates/index.html index b96fc7a5..65cdaf49 100644 --- a/practice-app/server/add_activity_api/templates/index.html +++ b/practice-app/server/add_activity_api/templates/index.html @@ -59,50 +59,50 @@

Add Activity

-
+
-
+
-
+
-
+

Get Activity

-
+
-
+
-
+
-
+

Delete Activity

-
+
-
+
-
+
-
+