forked from ruby-grape/grape-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
42 lines (34 loc) · 1.02 KB
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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