Sha256: 2df9e7a9d0248a1e65e643c69b2b71264f876b04050d319c2fc3c5a1dc1cea02

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

require 'sinatra'
require 'rack'

class Florida::SinatraServer; end
require 'florida/sinatra_server/router'

module Florida
  class SinatraServer
    attr_reader :sinatra_app

    def initialize(app, params = {})
      @sinatra_app = Class.new(Sinatra::Base)
      @params = params
      setup(app)
    end

    def application
      @sinatra_app
    end

    def run
      Rack::Server.start(app: @sinatra_app.new, Port: @params[:port] || 4567)
    end

    def self.run(app, params = {})
      self.new(app, params).run
    end

    private
    def setup(app)
      Router.setup(app, @sinatra_app)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
florida-0.0.2 lib/florida/sinatra_server.rb