Class: Mihari::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/mihari/web/app.rb

Class Method Summary collapse

Class Method Details

.run!(port: 9292, host: "localhost") ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/mihari/web/app.rb', line 36

def run!(port: 9292, host: "localhost")
  url = "http://#{host}:#{port}"

  Rack::Handler::Puma.run self, Port: port, Host: host do |server|
    Launchy.open url

    [:INT, :TERM].each do |sig|
      trap(sig) do
        server.shutdown
      end
    end
  end
end