/actix_lambda_http

Actix Web Framework 1.x ←🔗→ AWS Lambda + API Gateway

Primary LanguageRustApache License 2.0Apache-2.0

actix_lambda_http

docs.rs

Actix-AWS Lambda connector for Actix 1.x

This crate provides an AWS Lambda handler function that responds to ALB and API Gateway proxy events using a provided Actix web application.

Usage

use actix_web::{App, HttpResponse, web};

fn index(req: actix_web::HttpRequest) -> HttpResponse {
    HttpResponse::Ok()
        .content_type("text/plain")
        .body(format!("request data:\n\n{:#?}", req))
}

fn main() {
    actix_lambda_http::LambdaHttpServer::new(|| {
        App::new()
            .wrap(actix_web::middleware::Logger::default())
            .route("/", web::to(index))
    })
    .binary_media_types(vec!["image/png"])
    .start()
    .unwrap();
}

License: MIT/Apache-2.0