Created
May 26, 2009 18:48
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
use Rack::ContentType, "text/plain" | |
use Rack::ContentLength | |
run lambda {|env| [200, {}, [env['REMOTE_ADDR'].split(",").first]]} |
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
require 'sinatra/base' | |
run Sinatra.new { | |
get('/') do | |
content_type "text/plain" # you can also use Rack::ContentType | |
# with Sinatra except here we want | |
# more control since Sinatra gives it | |
# to us. Rack::ContentType sets the | |
# Content-Type on every route/url for | |
# the current mapping. | |
request.env['REMOTE_ADDR'].split(",").first | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment