main.rs 26 lignes · 624 octets
use axum::{routing::get, Router};
use rustwarden_core::prelude::*;
use sea_orm::DatabaseConnection;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    RustwardenApp::builder()
        .from_env()
        .with_ui(rustwarden_ui::browser_routes)
        .merge_machine_routes(rustwarden_ui::api_routes())
        .auto_migrate(true)
        .merge_routes(app_routes())
        .build()
        .await?
        .run()
        .await
}

fn app_routes() -> Router<DatabaseConnection> {
    Router::new()
        .route("/api/hello", get(hello))
}

async fn hello() -> &'static str {
    "Hello from {{project-name}}!"
}