# call

> HTTP Router

Latest version **5.0.3** (published 2018-11-03) · BSD-3-Clause license · 0 weekly downloads

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

## Install

```sh
npm install call
pnpm add call
yarn add call
bun add call
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 5.0.3 |
| Published | 2018-11-03 |
| First published | 2014-09-14 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 22.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 37 |
| Maintainers | hueniverse, marsup, nlf, wyatt |
| Keywords | HTTP, router |

## Links

- npm: https://www.npmjs.com/package/call
- Repository: https://github.com/hapijs/call
- Homepage: https://github.com/hapijs/call#readme
- Issues: https://github.com/hapijs/call/issues
- npm.io page: https://npm.io/package/call

## Dependencies (2)

- [boom](https://npm.io/package/boom.md) 7.x.x
- [hoek](https://npm.io/package/hoek.md) 6.x.x

## 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

- 5.0.3 (latest) — 2018-11-03
- 4.1.2 (v4-legacy) — 2024-01-02
- 5.0.2 — 2018-11-01
- 5.0.1 — 2017-11-03
- 5.0.0 — 2017-09-26
- 4.0.2 — 2017-05-28
- 4.0.1 — 2017-03-20
- 4.0.0 — 2016-11-29
- 3.0.4 — 2016-11-29
- 3.0.3 — 2016-07-27
- 3.0.2 — 2016-07-04
- 3.0.1 — 2016-05-19
- 3.0.0 — 2015-11-01
- 2.0.2 — 2015-06-28
- 2.0.1 — 2014-11-23
- … 2 more at https://npm.io/package/call/versions

## README

# call - Simple HTTP Router

[![Build Status](https://secure.travis-ci.org/hapijs/call.png)](http://travis-ci.org/hapijs/call)

### Lead Maintainer - [Eran Hammer](https://github.com/hueniverse)

## Introduction
`call` is a simple node.js HTTP Router. It is used by popular [hapi.js](https://github.com/hapijs/hapi) web framework. It implements predictable and easy to use routing. Even if it is designed to work with Hapi.js, you can still use it as an independent router in your app.

## Example

``` javascript
const Call = require('call');

// Create new router
const router = new Call.Router();

// Add route
router.add({ method: 'get', path: '/' }, { label: 'root-path' });

// Add another route
router.add({ method: 'post', path: '/users' }, 'route specific data');

// Add another route with dynamic path
router.add({ method: 'put', path: '/users/{userId}' }, () => { /* ...handler... */ });

// Match route
router.route('post', '/users');
/* If matching route is found, it returns an object containing
    {
        params: {},                     // All dynamic path parameters as key/value
        paramsArray: [],                // All dynamic path parameter values in order
        route: 'route specific data';   // routeData
    }
*/


// Match route
router.route('put', '/users/1234');
/* returns
    {
        params: { userId: '1234' },
        paramsArray: [ '1234' ],
        route: [Function]
    }
*/
```

## API
See the detailed [API Reference](./API.md).

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