# aws-lama

> AWS Lambda Mapper - Useful for converting http request/response pairs into lambda function event/context pairs and vice versa.

Latest version **0.0.1** (published 2021-07-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install aws-lama
pnpm add aws-lama
yarn add aws-lama
bun add aws-lama
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-07-20 |
| First published | 2020-12-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rayepps |
| Maintainers | rayepps |

## Links

- npm: https://www.npmjs.com/package/aws-lama
- npm.io page: https://npm.io/package/aws-lama

## Dependencies (1)

- [type-is](https://npm.io/package/type-is.md) ^1.6.18

## Recent versions

- 0.0.1 (latest) — 2021-07-20
- 0.0.3-alpha — 2021-02-10
- 0.0.2-alpha — 2021-01-06
- 0.0.1-alpha — 2020-12-21

## README

# AWS Lama
AWS Lambda Mapper - Useful for converting http request/response pairs into lambda function event/context pairs and vice versa.

## Install
```sh
yarn add aws-lama
```

## Usage
Example here is allowing a next.js app to run on lambda without a server. Lama converts the event/context into a pseudo http request response. All changes to the response that next.js makes during its invocation are recorded. Once the response has ended, were using lama to convert that response object into an api gateway response that contains any details/chagnes/data that were applied to the http response.
```js
const lama = require('aws-lama')
const next = require('next')

const app = next({ dev: false })
const handle = app.getRequestHandler()

const {
  NEXT_PATH = '/'
} = process.env

exports.handler = async (event, context) => {

  const { req, res } = await lama.toRequestResponse(event, context)

  if (NEXT_PATH === '*') handle(req, res)
  else app.render(req, res, NEXT_PATH, req.params)

  await res.ended()
  const response = lama.toApiGatewayResponse(req, res)

  return response
}
```

---
_Source: https://npm.io/package/aws-lama · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
