# connect-route-ext

> Extended simple and fast router for Connect

Latest version **1.0.6** (published 2020-01-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install connect-route-ext
pnpm add connect-route-ext
yarn add connect-route-ext
bun add connect-route-ext
```

## 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.6 |
| Published | 2020-01-01 |
| First published | 2017-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 2 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Ferdinand Prantl |
| Maintainers | prantlf |
| Keywords | router, connect |

## Links

- npm: https://www.npmjs.com/package/connect-route-ext
- Repository: https://github.com/prantlf/connect-route
- Issues: https://github.com/prantlf/connect-route/issues
- npm.io page: https://npm.io/package/connect-route-ext

## Dependencies (2)

- [@semantic-release/git](https://npm.io/package/@semantic-release/git.md) ^7.0.18
- [@semantic-release/changelog](https://npm.io/package/@semantic-release/changelog.md) ^3.0.6

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

- 1.0.6 (latest) — 2020-01-01
- 1.0.5 — 2020-01-01
- 1.0.4 — 2020-01-01
- 1.0.3 — 2020-01-01
- 1.0.2 — 2019-06-07
- 1.0.1 — 2019-03-10
- 1.0.0 — 2018-04-27
- 0.2.2 — 2017-12-22
- 0.2.1 — 2017-11-26
- 0.2.0 — 2017-11-26

## README

[![NPM version](https://badge.fury.io/js/connect-route-ext.png)](http://badge.fury.io/js/connect-route-ext)
[![Build Status](https://travis-ci.org/prantlf/connect-route.svg?branch=combined)](https://travis-ci.org/prantlf/connect-route)
[![codecov](https://codecov.io/gh/prantlf/connect-route/branch/combined/graph/badge.svg)](https://codecov.io/gh/prantlf/connect-route)
[![dependencies Status](https://david-dm.org/prantlf/connect-route/status.svg)](https://david-dm.org/prantlf/connect-route)
[![devDependencies Status](https://david-dm.org/prantlf/connect-route/dev-status.svg)](https://david-dm.org/prantlf/connect-route?type=dev)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

[![NPM Downloads](https://nodei.co/npm/connect-route-ext.png?downloads=true&stars=true)](https://www.npmjs.com/package/connect-route-ext)

# About

Extended, but still simple and fast router for [connect] or other middleware with the same interface.

# Installation

You will need [node] version >= 6 and [npm] to install and use this module:

    npm install connect-route-ext

# Usage

```js
var connectRoute = require('connect-route-ext')
var connect = require('connect')
var app = connect()

app.use(connectRoute(function (router) {
  router.get('/', function (req, res, next) {
          res.end('index')
        })
        .get('/home', function (req, res, next) {
          res.end('home')
        })
        .get('/home/:id', function (req, res, next) {
          res.end('home ' + req.params.id)
        })
        .get('/home/*path', function (req, res, next) {
          res.end('home ' + req.params.path.join('/'))
        })
        .post('/home', function (req, res, next) {
          res.end('POST to home')
        })

  function authenticate(req, res, next) {
    if (authenticated(req)) {
      next()
    } else {
      fail(res)
    }
  }

  router.get('/secret', authenticate, function (req, res, next) {
    res.end('secret')
  })
}))

app.listen(3000)
```

## Background

This project started as a fork of [connect-route] and added functionality to support usage scenarios needed by a more complex server, which supports an SPA:

* Match the rest of the path by "*path" parameter
* Pass multiple chained handlers to a single route

## Contributing

In lieu of a formal style guide, take care to maintain the existing coding style.

## License

Copyright (c) 2017-2020 Ferdinand Prantl
Copyright (c) 2012 Vadim M. Baryshev

Licensed under the MIT license.

[node]: https://nodejs.org
[npm]: https://npmjs.org
[connect]: https://github.com/senchalabs/connect
[connect-route]: https://github.com/baryshev/connect-route

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