diff options
-rw-r--r-- | lib/opentox.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb index 2adc04c..c14d352 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -32,7 +32,7 @@ module OpenTox config.allow do |allow| allow.origins '*' allow.resource "/#{SERVICE}/*", - :methods => [:get, :post, :put ], + :methods => [:head, :get, :post, :put, :options], :headers => :any, :max_age => 0 end @@ -196,6 +196,14 @@ module OpenTox } ORDER BY ?o ", @accept) end + # generic route to swagger API file + get "/#{SERVICE}/api/?" do + response['Content-Type'] = "application/json" + api_file = File.join('api', 'swagger.json') + bad_request_error "API Documentation in Swagger JSON is not implemented.", uri("/#{SERVICE}/api") unless File.exists?(api_file) + File.read(api_file) + end + # Create a new resource post "/#{SERVICE}/?" do @uri = uri("/#{SERVICE}/#{SecureRandom.uuid}") |