myro
universal bidirectional microrouter
Last updated 4 years ago by steos .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install myro 
SYNC missed versions from official npm registry.

myro

Build Status

myro is a universal bidirectional micro-router.

It works with pure data and is only concerned with route matching. No assumptions are made on how to handle or dispatch a route match. Implementation of that logic is left to the user.

Getting Started

Installation

npm install myro --save

Example


import myro from 'myro'

const route = myro({
    '/': {
        name: 'index'
    },

    '/users': {
        name: 'users',
        routes: {
            '/:name': {
                name: 'user'
            }
        }
    },

    '/about': {
        name: 'about'
    }
})

// match routes...
route('/users/foo')) // {name: "users.user", params: {name: "foo"}, route: fn}
route('/about')) //  {name: "about", params: {}, ... }


// retrieve the path
route.users.user({name: 'foo'}) // "/users/foo"
route.about() // "/about"


Documentation

  • Introduction
  • Myro Examples (Coming Soon)
  • Myro React Examples (Coming Soon)

License

Copyright © 2016 Stefan Oestreicher and contributors.

Distributed under the terms of the BSD-3-Clause license.

Current Tags

  • 0.6.3-alpha.0                                ...           latest (4 years ago)

9 Versions

  • 0.6.3-alpha.0                                ...           4 years ago
  • 0.6.2                                ...           4 years ago
  • 0.6.1                                ...           4 years ago
  • 0.6.0                                ...           4 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (10)

Copyright 2014 - 2016 © taobao.org |