Module: Fronde::Preview

Defined in:
lib/fronde/preview.rb

Overview

rubocop:disable Style/Documentation

Defined Under Namespace

Classes: Servlet

Class Method Summary collapse

Class Method Details

.startObject



49
50
51
52
53
54
55
56
57
# File 'lib/fronde/preview.rb', line 49

def self.start
  # Inspired by ruby un.rb library, which allows normally to start a
  # webrick server in one line: ruby -run -e httpd public_html -p 5000
  port = Fronde::CONFIG.get(%w[preview server_port], 5000)
  s = WEBrick::HTTPServer.new(Port: port)
  s.mount '/', Servlet
  %w[TERM QUIT INT].each { |sig| trap(sig, proc { s.shutdown }) }
  s.start
end