-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
31 lines (27 loc) · 843 Bytes
/
app.rb
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
require 'rubygems'
require 'bundler'
require 'sinatra'
require 'sinatra/reloader' if development?
require 'bundler'
require 'sinatra/json'
require 'sinatra/cookies'
require 'sinatra/flash'
require './controller'
# require './model'
require './assets'
require './helpers'
Bundler.require(:default)
configure do
enable :sessions
set :json_encoder, :to_json
set :erb, :layout => false, :format => :html5
end
before do
headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Headers'] = 'accept, authorization, origin'
end
options '*' do
response.headers['Allow'] = 'HEAD,GET,PUT,DELETE,OPTIONS,POST'
response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Cache-Control, Accept'
end