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
583 downloads per month
26KB
570 lines
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