Mam prostą applikację w sinatrze => https://gist.github.com/regedarek/979cf11df3f69d65db55
# app/routes/v2/accounts.rb
module Oauth2Provider
module Routes
module V2
class Accounts < Base
get '/accounts' do
content_type :json
'version 2'
end
end
end
end
end
# app.rb
require 'rubygems'
require 'bundler'
# Setup load paths
Bundler.require
$: << File.expand_path('../', __FILE__)
$: << File.expand_path('../lib', __FILE__)
require 'sinatra/base'
require 'app/models'
require 'app/routes'
module Oauth2Provider
class App < Sinatra::Application
configure do
set :database, {
adapter: "sqlite3",
database: "db/oauthdb.sqlite3"
}
end
use Oauth2Provider::Routes::V1::Accounts
use Oauth2Provider::Routes::V2::Accounts
end
end
include Oauth2Provider::Models
# config.ru
require './app'
run Oauth2Provider::App
W jaki sposób mógłbym dodać do niej wersjonowanie aby po na przykład nagłówku rozpoznawać numer wersji i taką wyświetlać. Czy stosujecie takie rozwiązanie? Bo nie znalazłem zbyt wielu informacji w sieci.