Created
February 27, 2012 15:42
-
-
Save peterhellberg/1924769 to your computer and use it in GitHub Desktop.
Echo posted JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'json' | |
post '/' do | |
JSON.parse(params[:data]).inspect | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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