bash
cargo add axum-sqlite
Provides Sqlite database for axum
.
```rust use axum::{Extension, response::Html, routing::get, Router}; use std::net::SocketAddr; use axum_sqlite::*;
async fn main() { let app = Router::new() .route("/", get(index)) .layer(Database::new(":memory:").unwrap()); axum::Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))) .serve(app.intomakeservice()) .await .unwrap(); }
async fn index(Extension(database): Extension