2.0.0-alpha.3 • Published 3 years ago

@nmathieu/router v2.0.0-alpha.3

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Router

A highly simple and customisable static router.

Getting started

Installation

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.

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

2.0.0-alpha.3

3 years ago

2.0.0-alpha.1

3 years ago

2.0.0-alpha.2

3 years ago

2.0.0-alpha.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago