Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gresau/rocket-lamb
A crate to allow running a Rocket webserver as an AWS Lambda Function with API Gateway or an Application Load Balancer
https://github.com/gresau/rocket-lamb
api-gateway lambda rocket rust
Last synced: 15 days ago
JSON representation
A crate to allow running a Rocket webserver as an AWS Lambda Function with API Gateway or an Application Load Balancer
- Host: GitHub
- URL: https://github.com/gresau/rocket-lamb
- Owner: GREsau
- License: mit
- Archived: true
- Created: 2019-07-28T11:30:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-01T16:45:18.000Z (over 5 years ago)
- Last Synced: 2025-01-17T04:31:15.997Z (17 days ago)
- Topics: api-gateway, lambda, rocket, rust
- Language: Rust
- Homepage:
- Size: 69.3 KB
- Stars: 81
- Watchers: 7
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚀 Rocket Lamb 🐑
[![Travis (.org)](https://img.shields.io/travis/GREsau/rocket-lamb?logo=travis)](https://travis-ci.org/GREsau/rocket-lamb)
[![Crates.io](https://img.shields.io/crates/v/rocket_lamb)](https://crates.io/crates/rocket_lamb)A crate to allow running a [Rocket](https://rocket.rs/) webserver as an AWS Lambda Function with API Gateway, built on the [AWS Lambda Rust Runtime](https://github.com/awslabs/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
```rust
#![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();
}
```For a full example including instructions on deploying to Lambda and configuring binary responses, see [Example Rocket Lamb API](https://github.com/GREsau/example-rocket-lamb-api).