# bedrock-routes

> A rule-based HTTP router for NodeJS

Latest version **1.0.0** (published 2016-07-13) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install bedrock-routes
pnpm add bedrock-routes
yarn add bedrock-routes
bun add bedrock-routes
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-07-13 |
| First published | 2016-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Sam Vervaeck |
| Maintainers | samvv |
| Keywords | http, server, router, api |

## Links

- npm: https://www.npmjs.com/package/bedrock-routes
- Repository: https://github.com/samvv/manabi
- Homepage: https://github.com/samvv/manabi#readme
- Issues: https://github.com/samvv/manabi/issues
- npm.io page: https://npm.io/package/bedrock-routes

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [micromatch](https://npm.io/package/micromatch.md) ^2.3.10
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^1.5.3

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-07-13

## README

Bedrock Router
==============

> A rule-based HTTP router for NodeJS.

## Motivation 

[Express](expressjs.com) is great, but it is limited when one wants to use it for advanced use cases, such as statistics gathering. Bedrock router solves these issues.

## API

```
const WebApp = require('bedrock-routes').WebApp
```

### new WebApp()

Constructs a new router. A router is an extension of Node's `http.Server`.

In addition to the usual [Node HTTP events](https://nodejs.org/api/http.html), these events are emitted:

 - **processingError**: when the route produced an error message
 - **notFound**: when no rule was found for the specified request

### app.listen(port?)

Listens on the specified port, or a random available port if no port is specified. Returns an empty promise.

### app.addRoute(route, callback)

Adds a route to the application. Callback has the form `(req, res) => any`, where `any` can be a promise which possibly gets rejected.

## Trivia

Manabi is named after a reqion in Ecuador which produces coffee beans.

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