Module: AgileProxy::Servers::Api

Defined in:
lib/agile_proxy/servers/api.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(webserver_host, webserver_port) ⇒ Object

Starts the webserver on the given host and port

Parameters:

  • webserver_host (String)

    The host for the server to run on

  • webserver_port (Integer)

    The port for the server to run on



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/agile_proxy/servers/api.rb', line 22

def start(webserver_host, webserver_port)
  #
  # The API runner
  runner = ::Goliath::Runner.new([], nil)
  runner.address = webserver_host
  runner.port = webserver_port
  runner.app = ::Goliath::Rack::Builder.app do
    use ::Rack::Static, root: File.join(ROOT, 'assets'), urls: ['/ui'], index: 'index.html'
    map '/api' do
      run ::AgileProxy::Api::Root.new
    end
  end
  runner.run

end