Created
June 15, 2010 14:40
-
-
Save ruboto/439213 to your computer and use it in GitHub Desktop.
This file contains 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
~/projects/jruby/sinatra-app ➔ cat config.ru | |
require 'rubygems' | |
require 'hello_world' | |
set :run, false | |
set :environment, :production | |
run Sinatra::Application | |
~/projects/jruby/sinatra-app ➔ cat hello_world.rb | |
require 'rubygems' | |
require 'sinatra' | |
require 'json/pure' | |
put '/foo' do | |
request_body = request.body.read # JSON String | |
puts "Incoming data: #{request_body}" | |
obj = JSON.parse(request_body) | |
return JSON.generate(obj) | |
end | |
~/projects/jruby/sinatra-app ➔ trinidad --threadsafe -r | |
Incoming data: { "foo": "bar" } | |
Jun 15, 2010 9:39:56 AM org.apache.catalina.core.ApplicationContext log | |
INFO: 0:0:0:0:0:0:0:1%0 - [15/Jun/2010 09:39:56] "PUT /foo " 200 13 0.0170 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment