# @types/trouter

> TypeScript definitions for trouter

Latest version **3.1.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/trouter
pnpm add @types/trouter
yarn add @types/trouter
bun add @types/trouter
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.1.4 |
| Published | 2023-11-07 |
| First published | 2019-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51444 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/trouter
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trouter
- npm.io page: https://npm.io/package/@types/trouter

## Recent versions

- 3.1.4 (latest) — 2023-11-07
- 3.1.2 (ts4.3) — 2023-09-12
- 3.1.1 (ts3.8) — 2021-12-24
- 3.1.0 (ts2.3) — 2019-07-16
- 3.1.3 — 2023-10-18
- 3.0.0 — 2019-03-11

## README

# Installation
> `npm install --save @types/trouter`

# Summary
This package contains type definitions for trouter (https://github.com/lukeed/trouter).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trouter.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trouter/index.d.ts)
````ts
declare namespace Trouter {
    interface FindResult<T> {
        params: { [k: string]: string };
        handlers: T[];
    }

    type HTTPMethod =
        | "ACL"
        | "BIND"
        | "CHECKOUT"
        | "CONNECT"
        | "COPY"
        | "DELETE"
        | "GET"
        | "HEAD"
        | "LINK"
        | "LOCK"
        | "M-SEARCH"
        | "MERGE"
        | "MKACTIVITY"
        | "MKCALENDAR"
        | "MKCOL"
        | "MOVE"
        | "NOTIFY"
        | "OPTIONS"
        | "PATCH"
        | "POST"
        | "PROPFIND"
        | "PROPPATCH"
        | "PURGE"
        | "PUT"
        | "REBIND"
        | "REPORT"
        | "SEARCH"
        | "SOURCE"
        | "SUBSCRIBE"
        | "TRACE"
        | "UNBIND"
        | "UNLINK"
        | "UNLOCK"
        | "UNSUBSCRIBE";
}

declare class Trouter<T = any> {
    use(pattern: string | RegExp, ...handlers: T[]): this;

    find(method: Trouter.HTTPMethod, url: string): Trouter.FindResult<T>;

    add(method: Trouter.HTTPMethod, pattern: string | RegExp, ...handlers: T[]): this;

    all(pattern: string | RegExp, ...handlers: T[]): this;

    get(pattern: string | RegExp, ...handlers: T[]): this;

    head(pattern: string | RegExp, ...handlers: T[]): this;

    patch(pattern: string | RegExp, ...handlers: T[]): this;

    options(pattern: string | RegExp, ...handlers: T[]): this;

    connect(pattern: string | RegExp, ...handlers: T[]): this;

    delete(pattern: string | RegExp, ...handlers: T[]): this;

    trace(pattern: string | RegExp, ...handlers: T[]): this;

    post(pattern: string | RegExp, ...handlers: T[]): this;

    put(pattern: string | RegExp, ...handlers: T[]): this;
}

export = Trouter;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: none

# Credits
These definitions were written by .

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