Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

Router implementation for Opal (very alpha)

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.