Crate lambda_flows

source ·
Expand description

Make a flow function working as a lambda service in Flows.network

Quick Start

To get started, let’s write a very tiny flow function.

use lambda_flows::{request_received, send_response};

#[no_mangle]
pub fn run() {
    request_received(|_qry, _body| {
        send_response(
            200,
            vec![(String::from("content-type"), String::from("text/html"))],
            "ok".as_bytes().to_vec(),
        );
    });
}

When a new request is received the callback closure of function request_received() will be called and send_response() is used to make the response.

Functions

Register a callback closure with the query and body of the request for the lambda service.
Set the response for the lambda service.