From 3a11ba2918795821600b7113d0758415718d263a Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 11 Jun 2018 12:46:06 +0200 Subject: combine gui with rest --- lib/api.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/api.rb (limited to 'lib/api.rb') diff --git a/lib/api.rb b/lib/api.rb new file mode 100644 index 0000000..28e33df --- /dev/null +++ b/lib/api.rb @@ -0,0 +1,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 -- cgit v1.2.3