lambda-flows 0.1.7

Lambda extension for flows.network
Documentation

This is a library for making your flow function acting as a lambda service in test.flows.network.

Example usage

use lambda_flows::{listen_to_request, message_from_request, send_response};

#[no_mangle]
pub fn register() {
    listen_to_request();
}

#[no_mangle]
pub fn work() {
    let (qry, body) = message_from_request();
    send_response(
        200,
        vec![(String::from("content-type"), String::from("text/html"))],
        "ok".as_bytes().to_vec(),
    );
}

In register() the listen_to_request will create a listener for the http request.

When a request is received, the work() will be called. We get the query and body using message_from_request then set the status, headers and body of the response using send_response.

The whole document is here.