diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..9fef8fb --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8 +WORKDIR /app + +ADD requirements.txt /app/requirements.txt + +RUN pip install --upgrade -r requirements.txt + +EXPOSE 8080 + +COPY ./ /app + +CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"] \ No newline at end of file diff --git a/__init__.py b/backend/__init__.py similarity index 100% rename from __init__.py rename to backend/__init__.py diff --git a/app.py b/backend/app.py similarity index 66% rename from app.py rename to backend/app.py index c07ce5a..468341c 100644 --- a/app.py +++ b/backend/app.py @@ -1,4 +1,5 @@ from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware from config.config import initiate_database from routes.request import router as RequestRouter @@ -11,6 +12,16 @@ app = FastAPI() async def start_database(): await initiate_database() +origins = ["*"] + +app.add_middleware( + CORSMiddleware, + allow_origins=origins, + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + app.include_router(RequestRouter, tags=["Requests"]) diff --git a/azure/__init__.py b/backend/azure/__init__.py similarity index 100% rename from azure/__init__.py rename to backend/azure/__init__.py diff --git a/azure/functions.py b/backend/azure/functions.py similarity index 100% rename from azure/functions.py rename to backend/azure/functions.py diff --git a/config/__init__.py b/backend/config/__init__.py similarity index 100% rename from config/__init__.py rename to backend/config/__init__.py diff --git a/config/config.py b/backend/config/config.py similarity index 100% rename from config/config.py rename to backend/config/config.py diff --git a/database/database.py b/backend/database/database.py similarity index 100% rename from database/database.py rename to backend/database/database.py diff --git a/models/request.py b/backend/models/request.py similarity index 100% rename from models/request.py rename to backend/models/request.py diff --git a/requirements.txt b/backend/requirements.txt similarity index 87% rename from requirements.txt rename to backend/requirements.txt index eaa6b96..984c0da 100644 --- a/requirements.txt +++ b/backend/requirements.txt @@ -7,3 +7,4 @@ fastapi==0.93.0 pydantic==1.10.5 passlib==1.7.4 beanie==1.17.0 +python-dotenv==1.0.0 \ No newline at end of file diff --git a/routes/admin.py b/backend/routes/admin.py similarity index 100% rename from routes/admin.py rename to backend/routes/admin.py diff --git a/routes/request.py b/backend/routes/request.py similarity index 100% rename from routes/request.py rename to backend/routes/request.py