# pambda-router

> Pambda for routing

Latest version **0.1.2** (published 2020-08-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install pambda-router
pnpm add pambda-router
yarn add pambda-router
bun add pambda-router
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-08-16 |
| First published | 2017-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kengo Nakatsuka |
| Maintainers | nak2k |
| Keywords | aws, lambda, pambda |

## Links

- npm: https://www.npmjs.com/package/pambda-router
- Repository: https://github.com/pambda/pambda-router
- Issues: https://github.com/pambda/pambda-router/issues
- npm.io page: https://npm.io/package/pambda-router

## Dependencies (3)

- [pambda](https://npm.io/package/pambda.md) ^0.1.0
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.1.0
- [lambda-callbackify](https://npm.io/package/lambda-callbackify.md) ^0.1.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2020-08-16
- 0.1.1 — 2020-08-16
- 0.1.0 — 2019-05-17
- 0.0.9 — 2018-04-26
- 0.0.8 — 2018-04-18
- 0.0.7 — 2018-03-15
- 0.0.6 — 2017-11-23
- 0.0.5 — 2017-07-24
- 0.0.4 — 2017-07-15
- 0.0.3 — 2017-06-18
- 0.0.2 — 2017-06-12
- 0.0.1 — 2017-05-22

## README

# pambda-router

[Pambda](https://github.com/pambda/pambda) for routing.

## Installation

```
npm i pambda-router
```

## Usage

``` javascript
import { compose, createLambda } from 'pambda';
import { router } from 'pambda-router';

export const handler = createLambda(
  compose(
    router()
      .get('/', next => (event, context, callback) => {
      })
      .toPambda()
  )
);
```

## router()

Create a Router instance.

## Router

### HTTP_METHOD(path, pambda)

Specify Pambda when a request for a method specified by `HTTP_METHOD` arrives for the resource specified by `path`.

The following can be specified as `HTTP_METHOD`:

- `head`
- `get`
- `post`
- `put`
- `delete`
- `patch`
- `options`

For the format of `path`, see [path-to-regexp](https://github.com/pillarjs/path-to-regexp#readme).

### all(path, pambda)

Specify Pambda when any method request arrived for the resource specified by `path`.

### toPambda()

Returns Pambda which synthesized routings.

## License

MIT

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