| """ | |
| Module Template for NCAkit | |
| Copy this folder and rename to create a new module. | |
| Usage: | |
| 1. Copy _template folder to modules/your_module_name/ | |
| 2. Update MODULE_NAME, MODULE_PREFIX, MODULE_DESCRIPTION | |
| 3. Implement your router and services | |
| 4. The module will be auto-discovered on startup | |
| """ | |
| from fastapi import FastAPI | |
| # =================== | |
| # Module Metadata | |
| # =================== | |
| MODULE_NAME = "template" | |
| MODULE_PREFIX = "/api/template" | |
| MODULE_DESCRIPTION = "Template module - copy and modify for your feature" | |
| def register(app: FastAPI, config): | |
| """ | |
| Register this module with the main FastAPI app. | |
| Called automatically by module_registry. | |
| Args: | |
| app: FastAPI application instance | |
| config: NCAkitConfig instance with all settings | |
| """ | |
| from .router import router | |
| # You can initialize services here and attach to app.state | |
| # Example: | |
| # from .services import MyService | |
| # app.state.my_service = MyService(config) | |
| # Register the router | |
| app.include_router(router, prefix=MODULE_PREFIX, tags=[MODULE_NAME]) | |