One more time refactoring arch and rewrite dockerfile add endpoints for posts
This commit is contained in:
BIN
backend/app/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
backend/app/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/__pycache__/main.cpython-313.pyc
Normal file
BIN
backend/app/__pycache__/main.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/api/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
backend/app/api/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
0
backend/app/api/v1/__init__.py
Normal file
0
backend/app/api/v1/__init__.py
Normal file
BIN
backend/app/api/v1/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
backend/app/api/v1/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/api/v1/__pycache__/posts.cpython-313.pyc
Normal file
BIN
backend/app/api/v1/__pycache__/posts.cpython-313.pyc
Normal file
Binary file not shown.
0
backend/app/api/v1/guestbook.py
Normal file
0
backend/app/api/v1/guestbook.py
Normal file
33
backend/app/api/v1/posts.py
Normal file
33
backend/app/api/v1/posts.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
router = APIRouter(
|
||||||
|
prefix="/posts",
|
||||||
|
tags=["posts"],
|
||||||
|
responses={404: {"description": "Not found"}},
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get("/")
|
||||||
|
async def get_posts():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/{id}")
|
||||||
|
async def get_post(id: int):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/")
|
||||||
|
async def create_post():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.put("/{id}")
|
||||||
|
async def update_post(id: int):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/{id}")
|
||||||
|
async def delete_post(id: int):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
import fastapi
|
import fastapi
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
|
#Import routes
|
||||||
|
from app.api.v1.posts import router as post_router
|
||||||
|
|
||||||
app = fastapi.FastAPI()
|
app = fastapi.FastAPI()
|
||||||
|
|
||||||
|
#Include routes
|
||||||
|
app.include_router(post_router)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ COPY . .
|
|||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|
||||||
CMD ["uv", "run", "app/main.py"]
|
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|||||||
Reference in New Issue
Block a user