I am looking to get the domain title during my Sinatra application but like a newbie I truly am battling to learn how to do that, and Yes, it should be possible!!

RACK::Request.host_with_port looks promising, but I'm not sure ways to get this from my application - how do you get stuff from RACK during my ruby code???

Or perhaps is there one other way - I am thinking I do not really do whenever a request happens (although it isn't bad), however i thought it would be better basically could simply do it once once the application loads up.

Any hints???

simply employ request.host within your code.

get  "/" do

  puts request.host #=> localhost


Have a look at:


to help you see all of the request atmosphere variables.

I believe that you're searching for