Router implementation for Opal (very alpha)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
lib
opal
spec
.gitignore
Gemfile
README.md
Rakefile
config.ru
opal-router.gemspec

README.md

opal-router

A simple router for Opal applications.

Installation

Add to your Gemfile:

gem 'opal-router', :git => 'git://github.com/adambeynon/opal-router.git'

Then, anywhere in your opal code:

require "opal-router"

Usage

require "opal-router"

router = Router.new

router.route("/users") do
  puts "need to show all users"
end

router.route("/users/:id") do |params|
  puts "need to show user: #{ params[:id] }"
end


# visit "example.com/#/users"
# visit "example.com/#/users/3"
# visit "example.com/#/users/5"

# => "need to show all users"
# => need to show user: 3
# => need to show user: 5

TODO

  • Support older browsers which do not support onhashchange.
  • Support not-hash style routes with HTML5 routing.

License

MIT