# mvcr

> Minimum Viable Client Router

Latest version **1.0.15** (published 2019-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install mvcr
pnpm add mvcr
yarn add mvcr
bun add mvcr
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.15 |
| Published | 2019-08-14 |
| First published | 2019-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Joe Snell |
| Maintainers | wulfmann |
| Keywords | router, spa, microrouter |

## Links

- npm: https://www.npmjs.com/package/mvcr
- Repository: https://github.com/wulfmann/mvcr
- npm.io page: https://npm.io/package/mvcr

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.15 (latest) — 2019-08-14
- 1.0.14 — 2019-08-14
- 1.0.13 — 2019-08-14
- 1.0.12 — 2019-08-14
- 1.0.11 — 2019-08-14
- 1.0.10 — 2019-08-14
- 1.0.8 — 2019-08-14
- 1.0.5 — 2019-08-14
- 1.0.4 — 2019-08-14
- 1.0.3 — 2019-08-14
- 1.0.0 — 2019-08-14

## README

# mvcr

Zero-Dependency Client-Side Javascript Router

## Description

This is a simple hash-based router that does path matching off of provided regular expressions.

## Install

`npm install mvcr`

## Usage

```js
    import Router from 'mvcr'

    const router = new Router({
        routes: {
            default: {
                re: /(.*)/,
                handler: function (ctx) {
                    console.log(ctx)
                }
            }
        }
    })

    router.start()
```

See the `example` directory.

## Handler

A handler for a given route is expected to be a function. At render time, this function will receive a context object containing a reference to the router instance and current route.

### Example

```js
    {
        router: {
            routes: {}
        },
        route: {
            path: '',
            query: {}
        }
    }
```

## Route

The route object that's passed in the context will contain the current path, along with an object referencing any query string that was passed.

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