/path-router

A simple front-end router with TypeScript and resolves.

Primary LanguageTypeScriptMIT LicenseMIT

Path Router

Path Router

Install

yarn add path-router-web
// or
npm install path-router-web

Usage

import { setHistoryOptions } from "path-router-web";

setHistoryOptions({
    baseUrl: "https://test.com/",
});

addRouter([{
    path: "something/:key1/:key2",
    resolves: [() => "resolve value"],
    loadingCallback: () => {
        console.log("Loading started");
    },
    callback: (firstResolve: string) => {
        console.log("Page loaded", firstResolve);
    },
}]);

Docs

https://codetraceio.github.io/path-router/

Contribute

Install dependencies

yarn install

Lint

yarn lint

Test

yarn test