land-sdk
provides api for Runtime.land to run faas function project with http trigger.
Add this to your Cargo.toml
:
```toml [dependencies] anyhow = "1.0.75" http = "0.2.9" land-sdk = "0.1.0-rc.2" wit-bindgen = "0.10.0"
[lib] crate-type = ["cdylib"] # target wasm32-wasi ```
```rust use landsdk::http::{Body, Request, Response}; use landsdk::http_main;
pub fn handlerequest(req: Request) -> Response { let url = req.uri().clone(); let method = req.method().tostring().touppercase(); http::Response::builder() .status(200) .header("X-Request-Url", url.tostring()) .header("X-Request-Method", method) .body(Body::from("Hello Runtime.land!!")) .unwrap() } ```
Apache-2.0