bash
cargo add axum-eyre
Crate which provides an Error
and Result
type which
can be used in a eyre
-like fashion.
```rust use axum::{response::Html, routing::get, Router}; use std::{fs::readtostring, net::SocketAddr}; use axum_eyre::Result;
async fn main() { let app = Router::new().route("/", get(index)); axum::Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))) .serve(app.intomakeservice()) .await .unwrap(); }
async fn index() -> Result> { let template = readtostring("index.html")?; Ok(Html(template)) } ```