main

Attribute Macro main 

Source
#[main]
Expand description

A macro that wraps your main function with the necessary boilerplate to run a Ruxt application. The main function should be an async function that returns a std::io::Result<()>. The macro will generate the necessary code to run an Actix Web server with the routes defined in the src/pages folder.

ยงExample

#[ruxt::main]
async fn main() -> std::io::Result<()> {
   let test_data = "Hello, World!";
   HttpServer::new(move || App::new().app_data(test_data.to_string()))
   .bind(("0.0.0.0", 8080))?
   .run()
   .await
}