# crossroads

> Flexible router which can be used in multiple environments

Latest version **0.12.2** (published 2015-07-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.2 |
| Published | 2015-07-31 |
| First published | 2011-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/crossroads) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1435 |
| Author | Miller Medeiros |
| Maintainers | millermedeiros |
| Keywords | routes, event, observer, routing, router |

## Links

- npm: https://www.npmjs.com/package/crossroads
- Repository: https://github.com/millermedeiros/crossroads.js
- Homepage: http://millermedeiros.github.com/crossroads.js/
- Issues: https://github.com/millermedeiros/crossroads.js/issues
- npm.io page: https://npm.io/package/crossroads

## Dependencies (1)

- [signals](https://npm.io/package/signals.md) <2.0

## 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.12.2 (latest) — 2015-07-31
- 0.12.1 — 2015-07-20
- 0.12.0 — 2013-01-21
- 0.11.0 — 2012-10-31
- 0.10.0 — 2012-08-12
- 0.9.1 — 2012-07-29
- 0.9.0 — 2012-05-29
- 0.8.0 — 2012-03-05
- 0.7.0 — 2011-11-02
- 0.6.0 — 2011-09-01
- 0.5.0 — 2011-08-17
- 0.4.0 — 2011-06-07

## README

[![Build Status](https://secure.travis-ci.org/millermedeiros/crossroads.js.svg)](https://travis-ci.org/millermedeiros/crossroads.js)

---

![Crossroads - JavaScript Routes](https://github.com/millermedeiros/crossroads.js/raw/master/_assets/crossroads_logo.png)


## Introduction ##

Crossroads.js is a routing library inspired by URL Route/Dispatch utilities present on frameworks like Rails, Pyramid, Django, CakePHP, CodeIgniter, etc...
It parses a string input and decides which action should be executed by matching the string against multiple patterns.

If used properly it can reduce code complexity by decoupling objects and also by abstracting navigation paths.

See [project page](http://millermedeiros.github.com/crossroads.js/) for documentation and more details.




## Links ##

 - [Project page and documentation](http://millermedeiros.github.com/crossroads.js/)
 - [Usage examples](https://github.com/millermedeiros/crossroads.js/wiki/Examples)
 - [Changelog](https://github.com/millermedeiros/crossroads.js/blob/master/CHANGELOG.md)



## Dependencies ##

**This library requires [JS-Signals](http://millermedeiros.github.com/js-signals/) to work.**



## License ##

[MIT License](http://www.opensource.org/licenses/mit-license.php)



## Distribution Files ##

Files inside `dist` folder.

 * crossroads.js : Uncompressed source code with comments.
 * crossroads.min.js : Compressed code.

You can install Crossroads on Node.js using [NPM](http://npmjs.org/)

    npm install crossroads



## Repository Structure ##

### Folder Structure ###

    dev       ->  development files
    |- lib          ->  3rd-party libraries
    |- src          ->  source files
    |- tests        ->  unit tests
    dist      ->  distribution files

### Branches ###

    master      ->  always contain code from the latest stable version
    release-**  ->  code canditate for the next stable version (alpha/beta)
    dev         ->  main development branch (nightly)
    gh-pages    ->  project page
    **other**   ->  features/hotfixes/experimental, probably non-stable code



## Building your own ##

This project uses [Node.js](http://nodejs.org/) for the build process. If for some reason you need to build a custom version install Node.js and run:

    node build

This will delete all JS files inside the `dist` folder, merge/update/compress source files and copy the output to the `dist` folder.

**IMPORTANT:** `dist` folder always contain the latest version, regular users should **not** need to run build task.



## Running unit tests ##

### On the browser ###

Open `dev/tests/spec_runner-dist.html` on your browser.

`spec_runner-dist` tests `dist/crossroads.js` and `spec_runner-dev` tests files inside
`dev/src` - they all run the same specs.


### On Node.js ###

Install [npm](http://npmjs.org) and run:

```
npm install --dev
npm test
```

Each time you run `npm test` the files inside the `dist` folder will be updated
(it executes `node build` as a `pretest` script).

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