Async-tiny - minimal async HTTP server

async_tiny

I've released async_tiny, a minimal async HTTP server for Rust, inspired by tiny_http. It is based on hyper using the http1 and server features and powered by tokio. async_tiny provides a fast async native alternative to blocking HTTP servers.

Links

Github
Crates.io

Why

I made async_tiny while building Velto, a web framework for Rust. Velto used to use tiny_http, but it lacked async support and it wasn't really built for modern HTTP. I wanted to make an async and easy to use tiny_http alternative so I made async_tiny.

Features

  • async using tokio
  • Uses hyper 1.x
  • minimal API

Example

use async_tiny::{Server, Response};

#[tokio::main]
async fn main() -> std::io::Result<()> {
    let mut server = Server::http("127.0.0.1:8080", true).await?;
    println!("Listening on http://127.0.0.1:8080");

    while let Some(request) = server.next().await {
        let msg = Response::from_string("Hello");
        let _ = request.respond(msg);
    }

    Ok(())
}

Status

async_tiny is still in early release, but is used by Velto. I'd like any feedback or contributions.

2 Likes

It's cool!

Thanks! If you have any feedback on it or what I could improve/add, i'd like it!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.