open-index/open-npm huggingface dataset:
npm package: @nmathieu/router
Description: A highly simple and customisable static router.
Latest version: 2.0.0-alpha.3

# Router

A highly simple and customisable static router.

## Getting started

### Installation

```sh
npm install --save @nmathieu/router
```

### Description

The package is divided in 2 main concepts.

#### **A router**

It stores all the routes and performs search between all routes.

#### **A route**

It stores all information such as supported HTTP methods, the URI.

---

Both supports feature extension using "mixins" in order to improve usage convinience or add extra properties for advanced usage.

### Usage example

This is an example of how the router can be used in an application.  
This is the result after the setup has been done.

```js
import { apiRouter } from ".../constants/routers/api";
import { match } from ".../libraries/match";

const route = match(apiRouter, "https://localhost:8080/path");

if (route) {
  // hello world
} else {
  throw new Error("Route not found");
}
```

### Setup

> TODO