INNER CODE UNIT · Rust

home

wasmCloud/wasmCloud · templates/http-api-with-distributed-workloads/http-api/src/lib.rs:29

async fn home(_req: Request<Body>) -> anyhow::Result<Response<Body>> {
    Response::builder()
        .status(StatusCode::OK)
        .header("Content-Type", "text/html")
        .body(UI_HTML.into())
        .map_err(Into::into)
}

#[derive(Deserialize)]
struct TaskRequest {
    worker: Option<String>,
    payload: String,
}

async fn create_task(mut req: Request<Body>) -> anyhow::Result<Response<Body>> {
    let task_request: TaskRequest = req
        .body_mut()
        .json()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…