Sinatra JSON output

Yesterday i needed some quick and dirty JSON output using Sinatra, ‘cause I was studying how HTTP requests works in iOS. To create JSON response with Sinatra, just do something like that:

get "/" do
  content_type :json
  File.read(File.join(File.dirname(__FILE__), 'presidents.json'))
end

You might also like

SinatraSimpleRouter

I am open sourcing a project that I have been using a lot lately. You can easily define routes and some rules...

Comparison between Rack, Sinatra and Webmachine

Benchmarking Ruby and Erlang

Healthyr - Rails app performance monitor

Open sourcing a lib I created to benchmark Rails apps, using ActiveSupport::Notifications

Download free e-book

Learn different strategies on API versioning with "Versioned APIs with Phoenix" free e-book