#wasmcloud #wasm #actor #webassembly #capability

wasmcloud-interface-httpserver

interface for actors to receive http requests (wasmcloud:httpserver)

22 releases (8 breaking)

0.9.0 Dec 20, 2022
0.8.1 Nov 23, 2022
0.6.1 Jul 18, 2022
0.5.0 Mar 1, 2022
0.1.0 Jul 23, 2021

#125 in WebAssembly

Download history 70/week @ 2022-12-01 49/week @ 2022-12-08 107/week @ 2022-12-15 44/week @ 2022-12-22 36/week @ 2022-12-29 69/week @ 2023-01-05 63/week @ 2023-01-12 66/week @ 2023-01-19 206/week @ 2023-01-26 164/week @ 2023-02-02 107/week @ 2023-02-09 192/week @ 2023-02-16 218/week @ 2023-02-23 148/week @ 2023-03-02 107/week @ 2023-03-09 101/week @ 2023-03-16

583 downloads per month

Apache-2.0 and maybe LGPL-3.0-or-later

26KB
570 lines

crates.io  TinyGo Version

wasmCloud HTTP Server Interface

This is the interface for an HTTP Server capability with the contract ID wasmcloud:httpserver

This folder contains

  • Model definition for wasmcloud:httpserver
  • Generated documentation (in HTML)
  • Generated Rust library (in Rust)

Any Rust actor or capability provider using wasmcloud:httpserver should rely upon this library. A capability provider implements the trait HttpServerReceiver.

Capability Provider Implementations

The following is a list of implementations of the wasmcloud:httpserver contract. Feel free to submit a PR adding your implementation if you have a community/open source version.

Name Vendor Description
HTTPServer wasmCloud wasmCloud HTTP Server implementation using the highly scalable warp web server.

Example Usage (🦀 Rust)

Implementing the HttpServer.HandleRequest operation

use wasmbus_rpc::actor::prelude::*;
use wasmcloud_interface_httpserver::{HttpRequest, HttpResponse, HttpServer, HttpServerReceiver};

#[derive(Debug, Default, Actor, HealthResponder)]
#[services(Actor, HttpServer)]
struct HelloActor {}

#[async_trait]
impl HttpServer for HelloActor {
    async fn handle_request(&self, _ctx: &Context, _req: &HttpRequest) -> RpcResult<HttpResponse> {
        Ok(HttpResponse {
            body: "Hello World".as_bytes().to_owned(),
            ..Default::default()
        })
    }
}

Dependencies

~9–20MB
~409K SLoC