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 =
Dir.pwd

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
  notFoundApp = -> {[404, {}, 'Not Found']}
  runner.app = ::Goliath::Rack::Builder.app do
    map '/' do
      run ::Rack::Cascade.new([::Rack::Static.new(notFoundApp, root: ROOT, urls: [''], index: 'index.html'), ::AgileProxy::StubHandler.new])
    end
  end
  runner.run
end