Skip to content

Commit

Permalink
UPDATE: add edpoint test
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzasaverio committed Feb 6, 2024
1 parent ba6ea51 commit 89c683c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 0 deletions.
15 changes: 15 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Use an official Python runtime with NVIDIA CUDA support
FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04

WORKDIR /app

# Copy your application files
COPY . /app

# Install Python and FastAPI dependencies
RUN apt-get update && apt-get install -y python3-pip && \
pip3 install --no-cache-dir -r requirements.txt

EXPOSE 8000

CMD uvicorn main:app --port=${PORT:-8000} --host=0.0.0.0
Empty file added backend/__init__.py
Empty file.
Empty file added backend/app/__init__.py
Empty file.
Empty file added backend/app/api/v1/__init__.py
Empty file.
Empty file.
8 changes: 8 additions & 0 deletions backend/app/api/v1/endponts/test_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from fastapi import APIRouter

router = APIRouter()


@router.get("/test")
async def test():
return {"message": "Test endpoint is working!"}
18 changes: 18 additions & 0 deletions backend/app/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from fastapi import FastAPI, HTTPException, status, Request
from fastapi.responses import RedirectResponse, JSONResponse
from app.api.v1.endponts import test_endpoint


app = FastAPI(title="Title")

app.include_router(test_endpoint.router, prefix="/api/v1")


@app.get("/")
async def root(request: Request):
return RedirectResponse(url="/docs", status_code=status.HTTP_307_TEMPORARY_REDIRECT)


@app.get("/metrics")
async def metrics():
return JSONResponse(content={"message": "Metrics not implemented"})

0 comments on commit 89c683c

Please sign in to comment.