# router-wrapper

> router-wrapper ==============

Latest version **0.1.4** (published 2015-05-08) · 0 weekly downloads

## Install

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

## 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.4 |
| Published | 2015-05-08 |
| First published | 2015-03-09 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | stewartml |

## Links

- npm: https://www.npmjs.com/package/router-wrapper
- npm.io page: https://npm.io/package/router-wrapper

## Recent versions

- 0.1.4 (latest) — 2015-05-08
- 0.1.3 — 2015-05-08
- 0.1.2 — 2015-05-08
- 0.1.1 — 2015-04-10
- 0.0.1 — 2015-03-09

## README

router-wrapper
==============

This project wraps the [express](https://github.com/strongloop/express) project router to add a couple of useful functions.

If you pass it a function which returns a promise it'll call the `.then()` method to handle exceptions for you.

You can also make it bind your handlers to an object of your choice.

Example
-------

```js
// wrap a router
var expressRouter = express.Router();
var router = new Router(expressRouter);

class MyController {
  constructor(router) {
    router
      // make sure the middleware and action get called with the correct `this`
      .context(this)
      // define a route with args to pass to middleware
      .get('/test', this.testAction);
  }

  testAction(request, response) {
    return getAPromiseSomehow()
      .then((x) => response.send(x));
  }
}

```

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