# @ingress/router

> A fast router middleware for ingress

Latest version **1.0.0-beta.16** (published 2023-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ingress/router
pnpm add @ingress/router
yarn add @ingress/router
bun add @ingress/router
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.16 |
| Published | 2023-04-23 |
| First published | 2017-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 110.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Caleb Boyd |
| Maintainers | calebboyd, sberan |
| Keywords | radix, trie, tree, router, path, http route |

## Links

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

## Dependencies (5)

- [@ingress/core](https://npm.io/package/@ingress/core.md) 1.0.0-beta.16
- [@ingress/types](https://npm.io/package/@ingress/types.md) 1.0.0-beta.16
- [router-tree-map](https://npm.io/package/router-tree-map.md) 0.1.6
- [secure-json-parse](https://npm.io/package/secure-json-parse.md) ^2.7.0
- [reflect-annotations](https://npm.io/package/reflect-annotations.md) 4.0.0-beta.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.0-beta.16 (latest) — 2023-04-23
- 1.0.0-beta.1 (beta) — 2017-01-12
- 0.1.0-alpha.5 — 2022-02-04
- 1.0.0-rc.20 — 2020-03-25
- 1.0.0-rc.19 — 2020-03-05
- 1.0.0-rc.18 — 2019-01-16
- 1.0.0-rc.17 — 2018-12-17
- 1.0.0-rc.16 — 2018-12-15
- 1.0.0-rc.14 — 2018-11-13
- 1.0.0-rc.13 — 2018-09-27
- 1.0.0-rc.12 — 2018-08-21
- 1.0.0-rc.11 — 2018-06-22
- 1.0.0-rc.10 — 2018-06-15
- 1.0.0-rc.9 — 2018-06-01
- 1.0.0-rc.8 — 2018-01-15
- … 16 more at https://npm.io/package/@ingress/router/versions

## README

## @ingress/router

The ingress router is an ingress addon that operates in an app driven by the `@ingrss/http` (or similar) driver. It's purpose is to enable requests to be handled by Controllers (classes) and Routes (methods).

The `@ingress/router` plugin introduces the `@Controller` and `@Route` decorators.
`@Controller` exists on an instance, and facilitates dependency collection of groups of routes, which are declared by `@Route` decorated class methods.

### Example

```typescript
import { Router, Route } from '@ingress/router'

const router = new Router()
const { Controller } = router

@Controller('/group')
class RouteGroup {
  @Route.Get('/handler')
  handler() {
    return 'Hello World'
  }
}
```

The above example, declares a route at `/group/handler` that returns an `HTTP 200 OK` with a body content of `Hello World` and a Content-Type of `ttext/plain;charset=UTF-8`

Alternatively, instead of through decorators, routes can be defined using the API

### API

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