-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split endpoints to two folders and return mock data
Signed-off-by: Andrea Waltlova <[email protected]>
- Loading branch information
1 parent
54920b3
commit 8e1d5d9
Showing
5 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}, | ||
] | ||
} |