Crate under

source ·
Expand description

Under is a batteries-included async HTTP framework built for easy development. Under is based on Tokio, an async runtime. Under is meant to take the headache out of developing HTTP servers, while still being fairly performant.

Getting Started

To get started, just add under and tokio to your Cargo.toml:

under = "0.3.7"
tokio = { version = "1.12.0", features = ["full"] } # or whatever the latest version is

Examples

async fn hello_world(_: under::Request) -> Result<under::Response, anyhow::Error> {
    Ok(under::Response::text("hello, world!"))
}

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let mut http = under::http();
    http.at("/").get(hello_world);
    http.listen("0.0.0.0:8080").await?;
    Ok(())
}

Re-exports

Modules

Structs

  • A stream of Bytes, used when receiving bodies.
  • Cookiecookie
    Representation of an HTTP cookie.
  • Structure that follows the builder pattern for building Cookie structs.
  • CookieJarcookie
    A collection of cookies that tracks its modifications.
  • The data stream of a body.
  • Information about a data transfer. This is the result of DataStream::into, and provides information about the state of the stream after the transfer.
  • A description of a path in the router.
  • A type that helps retrieve the remote address of a request.
  • Represents an HTTP request.
  • An HTTP response.
  • An HTTP router.

Enums

  • FromFormErrorfrom_form
    The error type for parsing a form.
  • Errors generated specifically from this library, and not its interactions user code.

Traits

Functions

Type Definitions

Derive Macros

  • Automatically derive FromForm from a struct.