bootstrap

Attribute Macro bootstrap 

Source
#[bootstrap]
Expand description

Enhanced bootstrap macro for zero-boilerplate application startup

This macro provides Laravel-style “convention over configuration” by automatically generating all the server setup code using auto-discovery of modules and controllers.

§Examples

§Zero-Boilerplate Bootstrap (NEW!)

use elif::prelude::*;
 
#[elif::bootstrap]
async fn main() -> Result<(), HttpError> {
    // Automatically generated:
    // - Module discovery from compile-time registry
    // - Controller auto-registration from static registry
    // - DI container configuration
    // - Router setup with all controllers
    // - Server startup on 127.0.0.1:3000
}

§With Custom Address

#[elif::bootstrap(addr = "0.0.0.0:8080")]
async fn main() -> Result<(), HttpError> {}

§With Custom Configuration

#[elif::bootstrap(config = HttpConfig::with_timeout(30))]
async fn main() -> Result<(), HttpError> {}

§With Middleware

#[elif::bootstrap(middleware = [cors(), auth(), logging()])]
async fn main() -> Result<(), HttpError> {}

§Full Configuration

#[elif::bootstrap(
    addr = "0.0.0.0:8080",
    config = HttpConfig::production(),
    middleware = [cors(), auth()]
)]
async fn main() -> Result<(), HttpError> {}

§Backward Compatibility with AppModule

#[elif::bootstrap(AppModule)]
async fn main() -> Result<(), HttpError> {}