summaryrefslogtreecommitdiff
path: root/lib/lazar-rest.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lazar-rest.rb')
-rw-r--r--lib/lazar-rest.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/lazar-rest.rb b/lib/lazar-rest.rb
new file mode 100644
index 0000000..dc806ce
--- /dev/null
+++ b/lib/lazar-rest.rb
@@ -0,0 +1,28 @@
+include OpenTox
+
+require 'rack/cors'
+
+set :show_exceptions => false
+
+# add CORS support for swagger
+use Rack::Cors do |config|
+ config.allow do |allow|
+ allow.origins '*'
+ allow.resource "/#{SERVICE}/*",
+ :methods => [:head, :get, :post, :put, :delete, :options],
+ :headers => :any,
+ :max_age => 0
+ end
+end
+before do
+ @accept = request.env['HTTP_ACCEPT']
+ response['Content-Type'] = @accept
+end
+
+[
+ "api.rb",
+ "compound.rb",
+ "dataset.rb",
+ "model.rb",
+ "validation.rb"
+].each{ |f| require_relative f }