Skip to content

Commit 40b5f75

Browse files
committed
docs: added descriptive docstring to routes/__init__.py file
1 parent 31668c5 commit 40b5f75

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

api/v1/routes/__init__.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1-
"""Router configuration.
1+
"""
2+
Router configuration.
3+
4+
This module sets up the routing for the API version, including the necessary
5+
routers for various modules. To add a new router to this configuration, follow
6+
the example below:
7+
28
Example:
3-
from fastapi import APIRouter
4-
from api.v1.routes.blog import blog
9+
1. Import the new router:
10+
from api.v1.routes.new_module import new_router
11+
12+
2. Include the router in the `api_version_one` router:
13+
api_version_one.include_router(new_router)
14+
15+
Usage:
16+
This configuration is included in the `main.py` application router to
17+
make the API version endpoints available.
518
6-
api_version_one = APIRouter(prefix="/api/v1")
19+
Example:
20+
from fastapi import FastAPI
21+
from api.v1.routes import api_version_one
722
8-
api_version_one.include_router(blog)
23+
app = FastAPI()
24+
app.include_router(api_version_one)
925
"""
1026

1127
from fastapi import APIRouter

0 commit comments

Comments
 (0)