summaryrefslogtreecommitdiff
path: root/lib/api.rb
blob: 28e33dfe085b3a2019bcdf7ea3ff4a5902023a10 (plain)
1
2
3
4
5
6
7
8
9
# route to swagger API file
get "/api/api.json" do
  response['Content-Type'] = "application/json"
  api_file = File.join("api", "api.json")
  bad_request_error "API Documentation in Swagger JSON is not implemented." unless File.exists?(api_file)
  api_hash = JSON.parse(File.read(api_file))
  api_hash["host"] = request.env['HTTP_HOST']
  return api_hash.to_json
end