A dynamic routes includer for FastAPI
Project description
fastapi_dynamic_routers is a Python library that simplifies the management of routes in FastAPI applications. It provides a clean and efficient way to register routes dynamically, enabling you to keep your codebase organized and maintainable, even as your application grows.
Key Features:
- Simplicity: The library comes with a straightforward implementation that seamlessly integrates with your FastAPI application.
- Ease of Use: With just a few lines of code, you can include or exclude routes from your application, providing the flexibility you need during development.
- Organized Codebase: By dynamically registering routes, you can maintain a clean and well-structured codebase, even in large-scale projects.
Usage Example:
# main.py
from fastapi import FastAPI
from fastapi_dynamic_routers import Routers
app = FastAPI()
# List of router modules to include dynamically
URLS = [
'path.to.APIRouter.instantiate',
'...'
]
# Initialize the dynamic routers
routers = Routers(app, URLS)()
In this example, simply modify the URLS list to add or remove routes from your FastAPI application. The dynamic routes includer will handle the registration, keeping your main file clean and focused.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file fastapi_dynamic_routers-0.1.1.tar.gz.
File metadata
- Download URL: fastapi_dynamic_routers-0.1.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3996e8b258a831df4045f8ee71f93eadeb05bf394e2ec641c4536278e12a4a96
|
|
| MD5 |
c14fc60c4410ec4354b7f13e98e498f4
|
|
| BLAKE2b-256 |
68868eb4e432a01327fff49d6aba9f93dbbb05ffe6ebd45fb23e0db59be7d9da
|