Skip to content

Instantly share code, notes, and snippets.

@peterhellberg
Created February 27, 2012 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterhellberg/1924769 to your computer and use it in GitHub Desktop.
Save peterhellberg/1924769 to your computer and use it in GitHub Desktop.
Echo posted JSON
require 'sinatra'
require 'json'
post '/' do
JSON.parse(params[:data]).inspect
end
$ ruby 01_echo_data.rb
== Sinatra/1.3.2 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
curl -d 'data={"foo":"bar"}' "http://0.0.0.0:4567/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment