1.0.0 • Published 8 years ago

bedrock-routes v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Bedrock Router

A rule-based HTTP router for NodeJS.

Motivation

Express 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, 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.