nestforge_core/module.rs
1use anyhow::Result;
2use axum::Router;
3
4use crate::Container;
5
6/*
7ControllerBasePath = metadata implemented by #[controller("/...")]
8*/
9pub trait ControllerBasePath {
10 fn base_path() -> &'static str;
11}
12
13/*
14ControllerDefinition = generated by #[routes] for a controller
15*/
16pub trait ControllerDefinition: Send + Sync + 'static {
17 fn router() -> Router<Container>;
18}
19
20/*
21ModuleDefinition = app module contract (manual for now)
22*/
23pub trait ModuleDefinition: Send + Sync + 'static {
24 fn register(container: &Container) -> Result<()>;
25
26 fn controllers() -> Vec<Router<Container>> {
27 Vec::new()
28 }
29}