Skip to content

jm/rack-mount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rack::Mount

A stackable dynamic tree based Rack router.

Rack::Mount supports Rack’s Cascade style of trying several routes until it finds one that is not a 404. This allows multiple routes to be nested or stacked on top of each other. Since the application endpoint can trigger the router to continue matching, middleware can be used to add arbitrary conditions to any route. This allows you to route based on other request attributes, session information, or even data dynamically pulled pulled from a database.

Usage

Currently, Rack::Mount supports the classic Rails router mapping API. (Support is planned for the Merb router API and the new Rails 3.0 API)

require 'rack/mount'
Routes = Rack::Mount::RouteSet.new

Routes.draw do |map|
  map.connect 'products', :app => ListProducts
  map.connect 'products/:id', :app => ShowProduct
end

run Routes

About

Stackable dynamic tree based Rack router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published