2 releases
0.7.1 | Oct 18, 2022 |
---|---|
0.7.0 | Oct 18, 2022 |
#26 in #capability
26KB
564 lines
oneitfarm HTTP Server Interface
This is the interface for an HTTP Server capability with the contract ID oneitfarm:httpserver
This folder contains
- Model definition for
oneitfarm:httpserver
- Generated documentation (in HTML)
- Generated Rust library (in Rust)
Any Rust actor or capability provider using oneitfarm:httpserver
should rely upon this library. A capability provider implements the trait HttpServerReceiver
.
Example Usage (🦀 Rust)
Implementing the HttpServer.HandleRequest
operation
use wasmbus_rpc::actor::prelude::*;
use oneitfarm_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
~13–30MB
~487K SLoC