the world’s most comprehensive and broadly adopted cloud

Banner

Bookmarks

4 items
use lambda_http::{run, service_fn, tracing, Error, Request, Response};

async fn function_handler(event: Request) -> Result<Response<String>, Error> {
     Ok(Response::builder()
        .status(200)
        .header("Content-Type", "text/json")
        .body("{message:json}")
        .map_err(Box::new)?)
}

#[tokio::main]
async fn main() -> Result<(), Error> {
    tracing::init_default_subscriber();

    run(service_fn(function_handler)).await
}