Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 0 additions & 142 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
22 changes: 18 additions & 4 deletions packages/aws-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@

Standard Server provides a unified interface for client-server communication across HTTP and message-based transports. It lets you write handlers against the same request, response, body, and streaming primitives whether the underlying transport is the Fetch API, Node.js HTTP, HTTP/2, or a peer-style message channel.

Standard Server ships as a small ecosystem of packages:

| Package | Description |
| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`@standardserver/core`](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md) | The shared contract: types, body parsing rules, validators, and SSE helpers |
| [`@standardserver/fetch`](https://github.com/middleapi/standardserver/blob/main/packages/fetch/README.md) | Fetch API adapter for browsers, workers, and other Fetch-based runtimes |
| [`@standardserver/node`](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md) | Node.js HTTP and HTTP/2 adapter |
| [`@standardserver/fastify`](https://github.com/middleapi/standardserver/blob/main/packages/fastify/README.md) | Fastify adapter built on the Node.js adapter |
| [`@standardserver/aws-lambda`](https://github.com/middleapi/standardserver/blob/main/packages/aws-lambda/README.md) | AWS Lambda adapter with response streaming |
| [`@standardserver/peer`](https://github.com/middleapi/standardserver/blob/main/packages/peer/README.md) | Message-based adapter for WebSocket, MessagePort, and custom transports |
| [`@standardserver/shared`](https://github.com/middleapi/standardserver/blob/main/packages/shared/README.md) | Internal utilities shared across the ecosystem |

This package is the AWS Lambda adapter for that model. It converts an API Gateway proxy event — payload format version 1.0 or 2.0, the latter also used by Lambda Function URLs — into a `StandardLazyRequest`, and writes a `StandardResponse` back through the stream provided by `awslambda.streamifyResponse`, so streaming bodies such as server-sent events flow to the client as they are produced instead of being buffered.

## Package overview
Expand Down Expand Up @@ -81,7 +93,7 @@ export const handler = awslambda.streamifyResponse(async (event, responseStream,

## Resolving Body

The event carries the request body as a fully buffered, optionally base64-encoded string. `resolveBody(hint?)` decodes it and then follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](../core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](../core/README.md#how-body-parsing-works) in the core README for the full algorithm.
The event carries the request body as a fully buffered, optionally base64-encoded string. `resolveBody(hint?)` decodes it and then follows the shared Standard Server resolution rules: an explicit `hint` wins, then the [`standard-server` header](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#the-standard-server-header), then inference from the content headers. See [how body parsing works](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md#how-body-parsing-works) in the core README for the full algorithm.

> [!TIP]
> For efficient communication, set the `standard-server` header to explicitly hint the body type, especially for file or binary streaming. For example, if you upload a file with a common `content-type` such as `application/json` but omit the `standard-server` header, the server may interpret it as JSON and parse it unexpectedly.
Expand All @@ -96,9 +108,7 @@ The event carries the request body as a fully buffered, optionally base64-encode

## Learn more

For the higher-level project overview, see the root [Standard Server README](../../README.md).

For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](../node/README.md), and for the shared contract, see the [core documentation](../core/README.md).
For the project overview and the shared contract, see the [core documentation](https://github.com/middleapi/standardserver/blob/main/packages/core/README.md). For the Node.js primitives this adapter is built on, see the [Node.js adapter documentation](https://github.com/middleapi/standardserver/blob/main/packages/node/README.md).

## Sponsors

Expand Down Expand Up @@ -183,3 +193,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
</table>

With thanks to 37 past sponsors who helped get us here.

## License

Distributed under the MIT License. See [LICENCE](https://github.com/middleapi/standardserver/blob/main/LICENCE) for more information.
Loading
Loading