class Redoxed::API::Web

Attributes

thread[R]

Public Class Methods

new(nodes, listen) click to toggle source
# File lib/redoxed/web.rb, line 9
def initialize nodes, listen
  require 'redoxed/web/webapp'
  listen, uri = listen.split '/'
  addr, _, port = listen.rpartition ':'
  port, addr = addr, nil if not port
  uri = '/' + uri.to_s
  @opts = {
    Host: addr,
    Port: port,
  }
  WebApp.set :nodes, nodes
  @app = Rack::Builder.new do
    map uri do
      run WebApp
    end
  end
end

Public Instance Methods

run() click to toggle source
# File lib/redoxed/web.rb, line 27
def run
  @thread = Thread.new do
    Rack::Handler::Puma.run @app, @opts
    exit!
  end
end