apalis_board_api/framework/
mod.rs

1#[cfg(feature = "actix")]
2pub mod actix;
3#[cfg(feature = "axum")]
4pub mod axum;
5
6pub trait RegisterRoute<B, T> {
7    fn register(self, backend: B) -> Self;
8}
9
10pub struct ApiBuilder<R> {
11    router: R,
12    #[allow(dead_code)]
13    root: bool,
14}
15
16impl<R> ApiBuilder<R> {
17    /// Create a new ApiBuilder with default settings
18    pub fn new(router: R) -> Self {
19        Self { router, root: true }
20    }
21    /// Create a new ApiBuilder with a custom scope
22    /// If `register_root` is true, the root routes (/, /tasks, /workers, /overview)
23    /// will be registered on the provided scope.
24    pub fn new_with_router(router: R, register_root: bool) -> Self {
25        Self {
26            router,
27            root: register_root,
28        }
29    }
30
31    /// Finalize the builder and return the router
32    pub fn build(self) -> R {
33        self.router
34    }
35}