Skip to main content
FastEdge HTTP applications respond to HTTP requests directly from the edge. The handler compiles to a WebAssembly binary and runs without servers or containers. Three language options are available — complete the toolchain setup first: Rust (Modern HTTP), Rust (Legacy HTTP), or JavaScript.

Write a handler

Each language uses a different entry point convention. Choose the tab that matches the toolchain set up earlier.
Replace src/lib.rs with:
use wstd::http::body::Body;
use wstd::http::{Request, Response};

#[wstd::http_server]
async fn main(request: Request<Body>) -> anyhow::Result<Response<Body>> {
    let url = request.uri().to_string();
    Ok(Response::builder()
        .status(200)
        .header("content-type", "text/plain;charset=UTF-8")
        .body(Body::from(format!("Request received: {url}")))?)
}

Build

Compile the handler to a WebAssembly binary. The first build downloads dependencies and takes one to two minutes.
cargo build --release --target wasm32-wasip2
The binary is at ./target/wasm32-wasip2/release/hello_world.wasm.

Deploy