1.0.1 • Published 10 years ago

spine-route v1.0.1

Weekly downloads
4
License
MIT
Repository
-
Last release
10 years ago

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) ->
		{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 us@bevry.me (http://bevry.me)

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