Module: AgileProxy::Servers::RequestSpecDirect

Defined in:
lib/agile_proxy/servers/request_spec_direct.rb

Overview

The API Server

This server is a RACK server responsible for providing access to the system using REST requests. This allows remote programming of the proxy using either a client adapter or the built in user interface

Constant Summary collapse

ROOT =
File.expand_path '../../../', File.dirname(__FILE__)

Class Method Summary collapse

Class Method Details

.start(server_host, server_port, static_dirs = []) ⇒ Object

Starts the server on the given host and port

Parameters:

  • server_host (String)

    The host for the server to run on

  • server_port (Integer)

    The port for the server to run on



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/agile_proxy/servers/request_spec_direct.rb', line 19

def start(server_host, server_port, static_dirs = [])

  runner = ::Goliath::Runner.new([], nil)
  runner.address = server_host
  runner.port = server_port
  runner.app = ::Goliath::Rack::Builder.app do
    use Rack::Static, root: File.join(ROOT, 'assets'), urls: static_dirs, index: 'index.html' unless static_dirs.empty?
    map '/' do
      run ::AgileProxy::StubHandler.new
    end
  end
  runner.run
end