Skip to content

Commit

Permalink
Add axum to doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNeikos committed Aug 9, 2021
1 parent 45a5514 commit 68161aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions docs/content/web-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,19 @@ This adds an implementation of `IntoResponse` for `Markup`/`PreEscaped<String>`.
This then allows you to use it directly as a response!

```rust,no_run
use maud::html;
use maud::{html, Markup};
use axum::prelude::*;
async fn hello_world() -> Markup {
html! {
h1 { "Hello, World!" }
}
}
#[tokio::main]
async fn main() {
// build our application with a single route
let app = route("/", get(|| async { html! { h1 { "Hello, World!" } } }));
let app = route("/", get(hello_world));
// run it with hyper on localhost:3000
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
Expand Down
4 changes: 3 additions & 1 deletion doctest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ edition = "2018"
actix-web = "3"
ammonia = "3"
iron = "0.6"
maud = { path = "../maud", features = ["actix-web", "iron", "rocket", "tide"] }
maud = { path = "../maud", features = ["actix-web", "iron", "rocket", "tide", "axum"] }
pulldown-cmark = "0.8"
rocket = "0.4"
rouille = "3"
tide = "0.16"
tokio = { version = "1.9.0", features = ["rt", "macros", "rt-multi-thread"] }
axum = "0.1.3"

[dependencies.async-std]
version = "1.9.0"
Expand Down

0 comments on commit 68161aa

Please sign in to comment.