-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.rb
31 lines (23 loc) · 880 Bytes
/
application.rb
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
module API
end
require 'grape'
require 'elasticsearch/persistence/model'
require 'grape-swagger'
require 'pry'
Dir["#{File.dirname(__FILE__)}/app/models/*.rb"].each {|f| require f}
Dir["#{File.dirname(__FILE__)}/app/**/*.rb"].each {|f| require f}
Dir["#{File.dirname(__FILE__)}/app/**/**/*.rb"].each {|f| require f}
Dir["#{File.dirname(__FILE__)}/lib/*.rb"].each {|f| require f}
env = (ENV['RACK_ENV'] || :development)
#initialize Elasticsearch
es_host = ENV['BONSAI_URL'] || 'http://localhost:9200'
Elasticsearch::Persistence.client = Elasticsearch::Client.new host: es_host, log: true
class API::Root < Grape::API
format :json
mount API::FoodTrucks
mount API::FoodTypes
add_swagger_documentation mount_path: "/api",
api_version: 'v1',
base_path: '/v1',
hide_format: true
end