# unmon-router

> a minimalist, express-like router

Latest version **1.0.1** (published 2017-08-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install unmon-router
pnpm add unmon-router
yarn add unmon-router
bun add unmon-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.0.1 |
| Published | 2017-08-27 |
| First published | 2017-08-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ansuz |
| Maintainers | ansuz |

## Links

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

## Recent versions

- 1.0.1 (latest) — 2017-08-27
- 1.0.0 — 2017-08-27

## README

```
'Said Ummon to his disciples,
"However wonderful a thing is,
it may be that it is better
not to have it at all."
```

# unmon-router

> a minimalist, express-like router

Unmon-router implements a lightweight, middleware router.
Its api makes it compatible with most express middleware.

## Usage

```js
var http = require('http');
var unmon = require('unmon-router');
var app = unmon();

// log all request URLs
app.route(/.*/, function (req, res, next) {
    console.log(req.url);
    next();
});

// handle API requests
app.route(/^\/api\//, function (req, res, next) {
    res.end('{}');
});

// serve 404s for everything else
app.route(/.*/, function (req, res) {
    res.statusCode = 404;
    res.end('404');
});

http.createServer(app.compile()).listen(3007);
```

## API

The above example illustrates the basic API.

1. initialize an app.
2. push middleware to a stack with `app.route`.
  * unlike express, unmon expects the url pattern to be a regex, not a string
  * the middleware function should use the `(request, response, callback)` signature
3. compile the app and pass it to the http module.

## Install

With [npm](https://npmjs.org/) installed, run

```
$ npm install unmon-router
```

## Acknowledgments

unmon-router was inspired by [Expressjs](https://github.com/expressjs/express).

## License

ISC

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