2015-01-22 06:38:48 +01:00
|
|
|
require 'sinatra'
|
|
|
|
|
require 'sinatra/activerecord'
|
|
|
|
|
require './config'
|
|
|
|
|
require 'json'
|
|
|
|
|
|
|
|
|
|
Dir[File.dirname(__FILE__) + '/models/*.rb'].each {|file| require file }
|
|
|
|
|
|
|
|
|
|
set :bind, '0.0.0.0'
|
|
|
|
|
|
2015-01-29 07:07:08 +01:00
|
|
|
|
2015-01-22 06:38:48 +01:00
|
|
|
before do
|
|
|
|
|
content_type :json
|
|
|
|
|
# TODO: before running to production change this so that only specific
|
|
|
|
|
# domain is allowed
|
|
|
|
|
headers 'Access-Control-Allow-Origin' => '*',
|
|
|
|
|
'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dir[File.dirname(__FILE__) + '/controllers/*.rb'].each {|file| require file }
|
|
|
|
|
|
|
|
|
|
|