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

#2042 in Network programming

Download history 13/week @ 2024-02-24 2/week @ 2024-03-02 7/week @ 2024-03-09 2/week @ 2024-03-16 49/week @ 2024-03-30 17/week @ 2024-04-06

66 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.5MB
~54K SLoC