diff --git a/frontend/index.html b/app/frontend/index.html
similarity index 100%
rename from frontend/index.html
rename to app/frontend/index.html
diff --git a/frontend/script.js b/app/frontend/script.js
similarity index 96%
rename from frontend/script.js
rename to app/frontend/script.js
index 6f6a61f..fbb5290 100644
--- a/frontend/script.js
+++ b/app/frontend/script.js
@@ -54,7 +54,7 @@ uploadForm.addEventListener('submit', async (event) => {
setStatus('Загрузка...', '');
try {
- const response = await fetch('http://192.168.0.132:5000/upload_file', {
+ const response = await fetch('/upload_file', {
method: 'POST',
body: formData
});
diff --git a/frontend/style.css b/app/frontend/style.css
similarity index 100%
rename from frontend/style.css
rename to app/frontend/style.css
diff --git a/app/main.py b/app/main.py
new file mode 100644
index 0000000..3aec6bf
--- /dev/null
+++ b/app/main.py
@@ -0,0 +1,33 @@
+from fastapi import FastAPI, File, UploadFile
+from fastapi.staticfiles import StaticFiles
+
+import dotenv
+import os
+
+import asyncio
+import uvicorn
+
+dotenv.load_dotenv()
+disable_docs = os.getenv("DISABLE_DOCS", "true").lower() == "true"
+app: FastAPI = FastAPI(title="DropMeFiles analog")
+# app: FastAPI = FastAPI(title="DropMeFiles analog",
+# summary="OpenAPI schema for \"DropMeFiles analog\" project!",
+# version="0.1",
+# contact={"GitHub": "https://github.com/IgorVolochay/Drop-me-files-analog"},
+# docs_url=None if disable_docs else "/docs",
+# redoc_url=None if disable_docs else "/redoc",
+# openapi_url=None if disable_docs else "/openapi.json")
+
+# app.mount("/", StaticFiles(directory="frontend", html=True), name="frontend")
+
+@app.post("/upload_file")
+async def create_upload_file(file: UploadFile = File(...)):
+ return {"filename": file.filename, "content_type": file.content_type}
+
+async def main():
+ config = uvicorn.Config("main:app", port=5000, host="0.0.0.0", log_level="debug")
+ server = uvicorn.Server(config)
+ await server.serve()
+
+if __name__ == "__main__":
+ asyncio.run(main())
\ No newline at end of file
diff --git a/backend/pyproject.toml b/app/pyproject.toml
similarity index 100%
rename from backend/pyproject.toml
rename to app/pyproject.toml
diff --git a/backend/main.py b/backend/main.py
deleted file mode 100644
index d1b5f22..0000000
--- a/backend/main.py
+++ /dev/null
@@ -1,49 +0,0 @@
-from fastapi import FastAPI, File, UploadFile
-from fastapi.middleware.cors import CORSMiddleware
-
-from typing import Annotated
-
-import dotenv
-import os
-
-import asyncio
-import uvicorn
-
-
-dotenv.load_dotenv()
-disable_docs = os.getenv("DISABLE_DOCS", "true").lower() == "true"
-app: FastAPI = FastAPI(title="This OR That",
- summary="OpenAPI schema for \"This OR That\" project!",
- version="0.1",
- contact={"GitHub": "https://github.com/IgorVolochay/thisORthat"},
- docs_url=None if disable_docs else "/docs",
- redoc_url=None if disable_docs else "/redoc",
- openapi_url=None if disable_docs else "/openapi.json")
-
-
-origins = ["*"]
-
-app.add_middleware(
- CORSMiddleware,
- allow_origins=origins,
- allow_credentials=True,
- allow_methods=["*"],
- allow_headers=["*"],
-)
-
-@app.get("/")
-def root():
- return "Hello!"
-
-@app.post("/upload_file")
-@app.post("/upload_file")
-async def create_file(file: Annotated[bytes, File()]):
- return {"file_size": len(file)}
-
-async def main():
- config = uvicorn.Config("main:app", port=5000, log_level="debug")
- server = uvicorn.Server(config)
- await server.serve()
-
-if __name__ == "__main__":
- asyncio.run(main())
\ No newline at end of file