lamedh_runtime 0.3.0

AWS Lambda Runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use lamedh_runtime::{handler_fn, run, Context, Error};
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Error> {
    run(handler_fn(func)).await?;
    Ok(())
}

async fn func(event: Value, _: Context) -> Result<Value, Error> {
    let first_name = event["firstName"].as_str().unwrap_or("world");

    Ok(json!({ "message": format!("Hello, {}!", first_name) }))
}