Skip to content

Commit

Permalink
Split endpoints to two folders and return mock data
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Waltlova <[email protected]>
  • Loading branch information
andywaltlova committed Oct 31, 2024
1 parent 54920b3 commit 8e1d5d9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from fastapi import FastAPI
from fastapi import APIRouter, FastAPI

from app.v1.endpoints import v1_router
from app.v1.released.endpoints import v1_router as released_v1_router
from app.v1.upcoming.endpoints import v1_router as upcoming_v1_router

# Initialize FastAPI app
app = FastAPI()

# Include the routers under versioned paths
app.include_router(v1_router, prefix="/v1")
# Create a main API router with the /api prefix
api_router = APIRouter()

# Include individual service routers under the main API router
api_router.include_router(released_v1_router, prefix="/v1/released", tags=["released"])
api_router.include_router(upcoming_v1_router, prefix="/v1/upcoming", tags=["upcoming"])

# Include the main API router in the FastAPI app with the prefix
app.include_router(api_router, prefix="/api")

File renamed without changes.
File renamed without changes.
Empty file added app/v1/upcoming/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions app/v1/upcoming/endpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from fastapi import APIRouter

v1_router = APIRouter()

@v1_router.get("/get-future-data")
async def get_relevant():
# TODO: This is a dummy function that returns a list of changes that are planned for the future.
# In a real application, this data would be fetched from a database or some other source.
return {
"changes": [
{"type": "feature", "description": "New feature 1", "release": "9.0"},
{"type": "retirement", "description": "Retiring feature 2", "release": "10.0"},
{"type": "bugfix", "description": "Fixing bug 3", "release": "8.6"},
{"type": "deprecation", "description": "Deprecating feature 4", "release": "9.0"},
]
}

0 comments on commit 8e1d5d9

Please sign in to comment.