File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 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+
28Example:
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
1127from fastapi import APIRouter
You can’t perform that action at this time.
0 commit comments