# biggie-router

> A lightweight extensible HTTP router

Latest version **1.2.0** (published 2013-06-12) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2013-06-12 |
| First published | 2011-01-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tim Smart |
| Maintainers | tim-smart |

## Links

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

## Recent versions

- 1.2.0 (latest) — 2013-06-12
- 1.1.0 — 2013-06-11
- 1.0.0 — 2013-06-11
- 0.3.4 — 2011-05-28
- 0.3.3 — 2011-05-28
- 0.3.2 — 2011-05-27
- 0.3.1 — 2011-05-27
- 0.3.0 — 2011-05-12
- 0.1.14 — 2011-03-10
- 0.1.0 — 2011-01-22
- 0.1.1 — 2011-01-22
- 0.1.10 — 2011-01-22
- 0.1.12 — 2011-01-22
- 0.1.2 — 2011-01-22
- 0.1.3 — 2011-01-22
- … 7 more at https://npm.io/package/biggie-router/versions

## README

Biggie-router is a high performance, extendable router for use in frameworks and
applications. It draws inspiration from several popular open source frameworks
and libraries, such as [jQuery](http://www.jquery.com/) and
[Sinatra](http://www.sinatrarb.com/).


## License

Biggie-router is released under MIT, in hope you find this software useful.


## Installing it

The fastest way to get started with biggie-router is to install it via **npm**.

    $ npm install biggie-router

Otherwise `git clone`, or download the repository and place the contents of the
`lib` directory where needed.


## Usage

Here are a few basic examples.

Hello world, that listens on port 8080:

    var http   = require('http')
    var Router = require('biggie-router');
    var server = http.createServer()
    var router = new Router(server);

    router.bind(function (request, response, next) {
      next.sendBody(200, "Hello World!");
    });

    server.listen(8080);

---

Basic routing + chaining. Responds with hello world on root and `/index.html`
get requests.

Requests that fall through (don't match any conditions) get passed to the next
route and are sent a 404.

    var Router = require('biggie-router');
    var router = new Router();

    router.get('/').get('/index.html')
          .bind(function (request, response, next) {
      next.sendBody(200, "Hello World!");
    });

    router.bind(function (request, response, next) {
      next.sendBody(404, 'Resource "' + request.url + '" not found.');
    });

    router.listen(8080);

---

Modules are functions that return a function, enabling you to do per-route
setup. No modules are supplied with biggie-router, however middleware use the
same pattern as connect (or express); so generic connect middleware should also
be compatible with biggie. The npm `middleware` module is also compatible.

Usage is as follows:

    var middleware = require('middleware');

    router.get('/').bind(middleware.sendfile('public/'));

    router.post('/users').bind(api('users', 'create'));

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