Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Forked from tmountain/gist:509955
Created August 6, 2010 18:34
Show Gist options
  • Save Oshuma/511754 to your computer and use it in GitHub Desktop.
Save Oshuma/511754 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