[][src]Crate rocket_lamb

A crate to allow running a Rocket webserver as an AWS Lambda Function with API Gateway, built on the AWS Lambda Rust Runtime.

The function takes a request from an AWS API Gateway Proxy and converts it into a LocalRequest to pass to Rocket. Then it will convert the response from Rocket into the response body that API Gateway understands.

This should also work with requests from an AWS Application Load Balancer, but this has not been tested.

Usage

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;
use rocket_lamb::RocketExt;

#[get("/")]
fn hello() -> &'static str {
    "Hello, world!"
}

fn main() {
    rocket::ignite()
        .mount("/hello", routes![hello])
        .lambda() // launch the Rocket as a Lambda
        .launch();
}

Structs

RocketHandler

A Lambda handler for API Gateway events that processes requests using a Rocket instance.

RocketHandlerBuilder

A builder to create and configure a RocketHandler.

Enums

BasePathBehaviour

Determines whether the API Gateway base path is included in the URL processed by Rocket. The default is RemountAndInclude.

ResponseType

Determines how to encode response content. The default is Auto.

Traits

RocketExt

Extensions for rocket::Rocket to make it easier to create Lambda handlers.