16 unstable releases (3 breaking)

0.4.1 Jul 19, 2023
0.4.0 Jul 18, 2023
0.3.1 May 3, 2023
0.2.2 Mar 3, 2023
0.1.1 Dec 30, 2022

#17 in #flows

Download history 38/week @ 2024-09-23 2/week @ 2024-10-14 85/week @ 2024-12-09

85 downloads per month

MIT/Apache

8KB
108 lines

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

For details, please refer to Lambda Integration.


lib.rs:

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]
#[tokio::main(flavor = "current_thread")]
pub async fn run() {
    request_received(handler).await;
}

async fn handler(_headers: Vec<(String, String)>, _qry: HashMap<String, Value>, _body: Vec<u8>) {
    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.

Dependencies

~1.6–2.7MB
~55K SLoC