Skip to content

The minimistic router from Spine, extracted microjs style

License

Notifications You must be signed in to change notification settings

bevry-archive/spine-route

Repository files navigation

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

  • Use: require('spine-route')
  • Install: npm install --save spine-route
  • Use: require('spine-route')
  • Install: npm install --save spine-route
  • CDN URL: //wzrd.in/bundle/[email protected]
  • 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:

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 [email protected] (http://bevry.me)

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