I have a Sinatra Application enclosed in Sinatra::Base
and I\'d like to run some code once the server has started, how should I go about doing this?
Her
Using the configure block is not the correct way to do this. Whenever you load the file the commands will be run.
Try extending run!
require 'sinatra'
require 'launchy'
class MyServer < Sinatra::Base
def self.run!
Launchy.open("http://#{settings.host}:#{settings.port}/")
super
end
get '/' do
"My server"
end
end