summaryrefslogtreecommitdiff
path: root/lib/lazar-rest.rb
blob: 2de399892db8c86752fb90122d722898f963fa70 (plain)
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
31
32
33
34
35
36
37
require "sinatra"
require "../lazar/lib/lazar.rb"
require "../qsar-report/lib/qsar-report.rb"
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

[
  "aa.rb",
  "api.rb",
  "compound.rb",
  "dataset.rb",
  "feature.rb",
  "model.rb",
  "nanoparticle.rb",
  "report.rb",
  "substance.rb",
  "validation.rb"
].each{ |f| require_relative f }