Comment

Comment by joshbuddy

Essentially, it let's you take something like

  before '/blog/:id' do
    @blog = Blog.get(params[:id])
  end
  
  get '/blog/:id' do
    @blog
  end
  
  put '/blog/:id' do
    @blog.update_attributes(params)
  end
and turn it into

  path 'blog' do
    var do |id|
      @blog = Blog.get(id)
      get { halt @blog }
      put { @blog.update(request.params); halt :ok}
    end
  end
I feel this is DRY'er than the Sinatra representation. It also has nice integration with Rack itself. The implementation is very simple, easy to get into.
parent joshbuddy 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton