spine-route

1.0.1 • Public • Published

spine-route

Build Status NPM version Dependency Status Development Dependency Status
Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button Wishlist browse button

The minimistic router from Spine, extracted microjs style.

Install

NPM

  • Use: require('spine-route')
  • Install: npm install --save spine-route

Browserify

  • Use: require('spine-route')
  • Install: npm install --save spine-route
  • CDN URL: //wzrd.in/bundle/spine-route@1.0.1

Ender

  • Use: require('spine-route')
  • Install: ender add spine-route

Usage

This is the Routing component of the Spine MVC framework extracted into its own module, microjs style.

For complete documentation, and usage, see the relevant spine documentation.

# Define our Application 
class App
    constructor: ->
        # Import the router 
        Route = require('spine-route').Route
 
        # Bind routes to our application methods 
        routes =
            '/': 'routeApp'
            '/site/:siteId/': 'routeApp'
            '/site/:siteId/:fileCollectionId': 'routeApp'
            '/site/:siteId/:fileCollectionId/*filePath': 'routeApp'
        for own key,value of routes
            Route.add(key@[value].bind(@))
 
        # Start the routing 
        Route.setup()
 
    routeApp: (opts) ->
        {siteIdfileCollectionIdfilePath} = opts
 
# Create our application 
app = new App()

History

Discover the change history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

  • Benjamin Lupton b@lupton.cc (https://github.com/balupton)

Sponsors

No sponsors yet! Will you be the first?

Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Become a contributor!

License

Licensed under the incredibly permissive MIT license

Copyright © 2013+ Bevry Pty Ltd us@bevry.me (http://bevry.me)

This work is based off prior work by Alex MacCaw and the Spine team, view their license here.

Package Sidebar

Install

npm i spine-route

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • bevryme