Sha256: e0ad2708c972edc858ad09126973739d0f0d0e34a92ca05c70d02a5fa79980d5

Contents?: true

Size: 1.02 KB

Versions: 36

Compression:

Stored size: 1.02 KB

Contents

require 'rack/cors'
use Rack::Cors do
  allow do
    origins '*'
    resource '*', headers: :any, methods: [:get, :post, :put, :delete, :options]
  end
end

require 'grape'

require './api/endpoints'
require './api/entities'

class Base < Grape::API
  require 'grape-entity'
  require '../lib/grape-swagger'
  format :json

  mount Api::Endpoints::Root
  mount Api::Endpoints::Splines
  mount Api::Endpoints::FileAccessor

  before do
    header['Access-Control-Allow-Origin'] = '*'
    header['Access-Control-Request-Method'] = '*'
  end

  # global exception handler, used for error notifications
  rescue_from :all do |e|
    raise e
    error_response(message: "Internal server error: #{e}", status: 500)
  end

  add_swagger_documentation hide_documentation_path: true,
                            api_version: 'v1',
                            info: {
                              title: 'Horses and Hussars',
                              description: 'Demo app for dev of grape swagger 2.0'
                            }
end

run Base.new

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
grape-swagger-1.4.2 example/config.ru
grape-swagger-1.4.1 example/config.ru
grape-swagger-1.4.0 example/config.ru
grape-swagger-1.3.1 example/config.ru
grape-swagger-1.3.0 example/config.ru
grape-swagger-1.2.1 example/config.ru
grape-swagger-1.2.0 example/config.ru
grape-swagger-1.1.0 example/config.ru
grape-swagger-1.0.0 example/config.ru
grape-swagger-0.34.2 example/config.ru
grape-swagger-0.34.1 example/config.ru
grape-swagger-0.34.0 example/config.ru
grape-swagger-0.33.0 example/config.ru
grape-swagger-0.32.1 example/config.ru
grape-swagger-0.32.0 example/config.ru
grape-swagger-0.31.1 example/config.ru
grape-swagger-0.31.0 example/config.ru
grape-swagger-0.30.1 example/config.ru
grape-swagger-0.30.0 example/config.ru
grape-swagger-0.29.0 example/config.ru