-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathv1.rb
30 lines (23 loc) · 933 Bytes
/
v1.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
# encoding: utf-8
require "json"
require 'pebblebed/sinatra'
require 'sinatra/petroglyph'
require 'sinatra/reloader'
Dir.glob("#{File.dirname(__FILE__)}/v1/**/*.rb").each{ |file| require file }
class KuduV1 < Sinatra::Base
set :root, "#{File.dirname(__FILE__)}/v1"
set :protection, :except => :http_origin
register Sinatra::Pebblebed
error ActiveRecord::RecordNotFound do
halt 404, "Record not found"
end
before do
response.headers['Cache-Control'] = 'public, max-age=300'
# If this service, for some reason lives behind a proxy that rewrites the Cache-Control headers into
# "must-revalidate" (which IE9, and possibly other IEs, does not respect), these two headers should properly prevent
# caching in IE (see http://support.microsoft.com/kb/234067)
headers 'Pragma' => 'no-cache'
headers 'Expires' => '-1'
cache_control :private, :no_cache, :no_store, :must_revalidate
end
end