Only lines code to create a server with ACME and HTTP3

use salvo::prelude::*;

#[handler]
async fn hello(res: &mut Response) {
    res.render(Text::Plain("Hello World"));
}

#[tokio::main]
async fn main() {
    let mut router = Router::new().get(hello);
    let listener = TcpListener::new("0.0.0.0:443")
        .acme()
        .cache_path("temp/letsencrypt")
        .add_domain("test.salvo.rs")
        .http01_challege(&mut router).quinn("0.0.0.0:443");
    let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
    Server::new(acceptor).serve(router).await;
}

Read more: https://github.com/salvo-rs/salvo

1 Like

To extend some context: the original poster is the author of salvo, a Rust web backend framework, and he's advertising the newly added feature that ACME and HTTP3 are supported in salvo.

I'm not related to salvo, and don't know the author in person.
The following information is from a tutorial video published days ago: 《Rust唠嗑室》第43期:朽木老师(上)_哔哩哔哩_bilibili (sorry, it's in Chinese and no English subtitles)

Salvo has started for years. The author was not satisfied with https://crates.io/crates/rocket but there weren't many choices back then, so he decided to make his own web framework. He's actively maintaining salvo, and using it in production. Salvo is less well-known but still powerful.

2 Likes