Expand description
AWS Lambda renderer implementation for HyperChad HTML applications.
This crate provides a Lambda-based runtime for HyperChad HTML renderers,
enabling serverless deployment of HyperChad applications on AWS Lambda.
It handles HTTP request/response processing, gzip compression, and
integrates with the HyperChad renderer framework.
§Features
assets- Enable static asset route support (enabled by default)json- Enable JSON response content type (enabled by default)debug- Enable debug logging (enabled by default)
§Example
use hyperchad_renderer_html_lambda::{LambdaApp, LambdaResponseProcessor, Content};
use hyperchad_renderer::ToRenderRunner;
use async_trait::async_trait;
use std::sync::Arc;
use bytes::Bytes;
#[derive(Clone)]
struct MyProcessor;
#[async_trait]
impl LambdaResponseProcessor<String> for MyProcessor {
fn prepare_request(
&self,
req: Request,
body: Option<Arc<Bytes>>,
) -> Result<String, lambda_runtime::Error> {
Ok(req.uri().path().to_string())
}
fn headers(&self, _content: &hyperchad_renderer::Content) -> Option<Vec<(String, String)>> {
None
}
async fn to_response(
&self,
data: String,
) -> Result<Option<(Content, Option<Vec<(String, String)>>)>, lambda_runtime::Error> {
Ok(Some((Content::Html(format!("<h1>Path: {}</h1>", data)), None)))
}
async fn to_body(
&self,
_content: hyperchad_renderer::Content,
_data: String,
) -> Result<Content, lambda_runtime::Error> {
Ok(Content::Html("<h1>Hello</h1>".to_string()))
}
}Re-exports§
pub use lambda_http;pub use lambda_runtime;
Structs§
- Lambda
App - Lambda application with configurable response processing.
- Lambda
AppRunner - Runtime handler for executing the Lambda application.
Enums§
- Content
- HTTP response content types for Lambda responses.
Traits§
- Lambda
Response Processor - Processes Lambda HTTP requests and generates responses.