Wynn Netherland changelog.com/posts

Renee - Sinatra-inspired Rack framework for über DRY routing

Josh Hull knows Sinatra. As part of the Padrino, he also knows about creating new alternatives to popular frameworks. His latest effort is Renee, a web framework for Rack that aims to DRY up your routes.

We wondered though, as Sinatra fans, if we were to come up with a cleaner and more powerful DSL, what might that look like? Let’s consider an example from Sinatra to see where we can do better.

The result is a pivoted syntax that turns the routing DSL on its side:

path 'blog' do
  var do |id|
    @blog = Blog.get(id)
    get { halt @blog }
    put { @blog.update(request.params); halt :ok}
  end
end

I can see how powerful this could be for creating complex REST APIs. Check out the nicely designed web site for more.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00