postrank-labs/goliath-contrib — pull request #5 by rsslldnphy (2012-09-14 21:50:47+00:00)
Title: Middleware to parse Rails style url parameters

Hi, I've created a piece of middleware to parse Rails style URL params. It accepts a URL pattern in the same format as a rails routes file and parses out the params, adding them to the `env['params']` hash.

So for example with this in your API:

use Goliath::Rack::PathParams, '/kittens/:name/:favourite_colour'

a request path of `'/kittens/jeremy/mauve'` would lead to a params hash containing:

{ 'name' => 'jeremy', 'favourite_colour' => 'mauve' }