spine-route
v1.0.1
Published
The minimistic router from Spine, extracted microjs style.
Downloads
11
Maintainers
Readme
spine-route
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/[email protected]
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) ->
{siteId, fileCollectionId, filePath} = 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 [email protected] (https://github.com/balupton)
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
License
Licensed under the incredibly permissive MIT license
Copyright © 2013+ Bevry Pty Ltd [email protected] (http://bevry.me)
This work is based off prior work by Alex MacCaw and the Spine team, view their license here.