This is a really simple question, but I cannot find any mention of this, anywhere..
How do I get the client's IP address from in Sinatra?
get '/' do
"Your IP address is #{....}"
end
This is a really simple question, but I cannot find any mention of this, anywhere..
How do I get the client's IP address from in Sinatra?
get '/' do
"Your IP address is #{....}"
end
I was coming to post the answer anyway.. so:
get '/' do
"Your IP address is #{ @env['REMOTE_ADDR'] }"
end
Sinatra uses the Rack::Request API, so you can use a lot of things available in it.
Also a link to the Sinatra doc's.