Skip to content

Instantly share code, notes, and snippets.

@tmountain
Created August 5, 2010 16:10
Show Gist options
  • Save tmountain/509955 to your computer and use it in GitHub Desktop.
Save tmountain/509955 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
require 'json'
def json_get(route, options={}, &block)
get(route, options) do
content_type 'text/json'
block.call.to_json
end
end
json_get '/' do
{"bar" => "baz", "foo" => "bar"}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment