AWS HTTP API Gateway Payload for Lambda
toml
[dependencies]
hegel = "0.1.0"
Hegel provides the lightest AWS HTTP API Gateway Payload for Lambda
It's recommended to use hegel with lambda_runtime
Hegel has two publicly accessible modules:
hegel::auth
and hegel::http
This module is used for building API Gateway Lambda Authorizers for HTTP APIs
The payloads are all designed for format 2.0
example code: ```rust use std::collections::HashMap; use lambdaruntime::{servicefn, Error}; use serde_json; use hegel::auth;
async fn main() -> Result<(), Error> { let func = servicefn(func); lambdaruntime::run(func).await?; Ok(()) }
async fn func(req: auth::Event) -> Result
The code is available under folder
src/bin/auth-example.rs
To avoid the heavy dependency
tokioas default, remember to add
--features binary` param when building the binary in this crate
This module is used for building API Gateway Lambda proxy integrations for HTTP APIs
The payloads are all designed for format 2.0
example: ```rust use lambdaruntime::{servicefn, Error}; use serde_json; use hegel::http;
async fn main() -> Result<(), Error> { let func = servicefn(func); lambdaruntime::run(func).await?; Ok(()) }
async fn func(req: http::Event) -> Result
The code is available under folder
src/bin/http-echo.rs
To avoid the heavy dependency
tokioas default, remember to add
--features binary` param when building the binary in this crate
Enable it when you want to get user request datetime in chrono::DateTime
type
Pass --features binary
to cargo when you want to build or check codes under folder src/bin/
example:
shell
$ cd ${the path to this repo}
$ cargo check --features binary
$ cargo lambda build --release --features binary
$ cargo lambda build --release --arm64 --features binary
MIT LICENSE