File size: 1,082 Bytes
7fa9d90 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """
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])
|