Sha256: 50cc36ddebca4eb54f7c9980eb4a9badaea13da5bd37f401f85a115561b62b43

Contents?: true

Size: 515 Bytes

Versions: 12

Compression:

Stored size: 515 Bytes

Contents

$:.push(File.dirname(__FILE__) + "/../lib")

# Just run `ruby examples/custom_class.rb` and then use something like
# `curl http://localhost:2345/api/v1/` and `curl http://localhost:2345/api/v2/`.

require "rack/api"

class MyApp < Rack::API
  prefix "api"

  version :v1 do
    get "/" do
      {:message => "Using API v1"}
    end
  end
end

class MyApp < Rack::API
  prefix "api"

  version :v2 do
    get "/" do
      {:message => "Using API v2"}
    end
  end
end

Rack::Handler::Thin.run MyApp, :Port => 2345

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rack-api-1.1.0 examples/custom_class.rb
rack-api-1.0.2 examples/custom_class.rb
rack-api-1.0.1 examples/custom_class.rb
rack-api-1.0.0 examples/custom_class.rb
rack-api-0.3.1 examples/custom_class.rb
rack-api-0.3.0 examples/custom_class.rb
rack-api-0.2.2 examples/custom_class.rb
rack-api-0.2.1 examples/custom_class.rb
rack-api-0.2.0 examples/custom_class.rb
rack-api-0.1.2 examples/custom_class.rb
rack-api-0.1.1 examples/custom_class.rb
rack-api-0.1.0 examples/custom_class.rb