Sha256: 6bb29f38835cef6cccb80a2f3bd83dcff28a85fbd98ee5c0cf92d19e7c2ab056

Contents?: true

Size: 486 Bytes

Versions: 12

Compression:

Stored size: 486 Bytes

Contents

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

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

require "rack/api"

Rack::API.app do
  prefix "api"

  version :v1 do
    get "/" do
      {:message => "You're using API v1"}
    end
  end

  version :v2 do
    get "/" do
      {:message => "You're using API v2"}
    end
  end
end

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

Version data entries

12 entries across 12 versions & 1 rubygems

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