Sha256: 7919f1eaae4cf8e7e86420dd01c0414a36435243966d6175e7f78994ae843c01

Contents?: true

Size: 631 Bytes

Versions: 5

Compression:

Stored size: 631 Bytes

Contents

require_relative 'responder'

module Nephos
  class Server

    attr_accessor :port, :host

    # @param port [Integer] port to listen
    def initialize port="8080", host="0.0.0.0"
      @port = Integer(port)
      @host = host.to_s
      @server = lambda {|env|
        router = Router.new
        return router.execute(Rack::Request.new(env))
      }
    end

    # start the Rack server
    def start
      Rack::Server.start :app => @server, :Port => @port, :Host => @host
    end

    # start the Rack server on a instance of Nephos::Server
    def self.start port, host
      Server.new(port, host).start
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nephos-server-0.6.5 lib/nephos-server/server/main.rb
nephos-server-0.6.4 lib/nephos-server/server/main.rb
nephos-server-0.6.3 lib/nephos-server/server/main.rb
nephos-server-0.6.2 lib/nephos-server/server/main.rb
nephos-server-0.6.1 lib/nephos-server/server/main.rb