# motion-router

> A simple client-side router

Latest version **0.3.6** (published 2016-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install motion-router
pnpm add motion-router
yarn add motion-router
bun add motion-router
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2016-07-15 |
| First published | 2016-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AeroXMotion |
| Maintainers | aeroxmotion |
| Keywords | router, front-end, client-side |

## Links

- npm: https://www.npmjs.com/package/motion-router
- Repository: https://github.com/aeroxmotion/motion-router
- Homepage: https://github.com/aeroxmotion/motion-router#readme
- Issues: https://github.com/aeroxmotion/motion-router/issues
- npm.io page: https://npm.io/package/motion-router

## 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

- 0.3.6 (latest) — 2016-07-15
- 0.3.5 — 2016-07-15
- 0.3.4 — 2016-07-08
- 0.3.3 — 2016-06-27
- 0.3.2 — 2016-06-27
- 0.3.1 — 2016-06-26
- 0.3.0 — 2016-06-26
- 0.2.1 — 2016-06-10
- 0.2.0 — 2016-06-10
- 0.1.1 — 2016-06-10
- 0.1.0 — 2016-06-07

## README

# MotionRouter

A simple client-side router with support for old browsers (Inspired on AngularJS Router and Laravel Router).

**Note:** The router use hash.

## Installation

  * Using bower:

    ```bash
    $ bower install motion-router
    ```

  * Using npm:

    ```bash
    $ npm install motion-router
    ```

## Usage

```js
// New router instance
var router = new MotionRouter();

// Routes
router
  .when('/', function() {
    console.log('Home');
  })
  .when('/one', callback);

// Prefix for routes
router.prefix('/group')
  .when('/one', callback) // #/group/one
  .when('/two', callback); // #/group/two

// Not registered route
router
  .otherwise(function() {
    router.redirect('/'); // Redirection to home
  });

// Run =D
router.run();
```

## Run example

```bash
$ npm run example
```

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