bedrock-routes

A rule-based HTTP router for NodeJS

This package has been deprecated. If you want to take over the package name, contact the author or npm directly.
Last updated 4 years ago by samvv .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install bedrock-routes 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0 [deprecated]           ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |