forked from concord-consortium/lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
44 lines (37 loc) · 1.03 KB
/
config.ru
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
38
39
40
41
42
43
#\ -p 9191
require 'rack-livereload'
require 'rack/cors'
require "./script/setup"
ENVIRONMENT = CONFIG[:environment]
puts "environment: #{ENVIRONMENT}"
use Rack::ConditionalGet
use Rack::ContentLength
Rack::Mime::MIME_TYPES.merge!({
".ttf" => "font/ttf",
".mml" => "application/xml",
".cml" => "application/xml",
".e2d" => "application/xml"
})
use Rack::Cors do
allow do
origins '*'
resource '*', :headers => :any, :methods => [:get, :head]
end
end
# see: https://github.com/johnbintz/rack-livereload
if ENVIRONMENT == 'development'
puts "using rack-live-reload"
map '/lab/jars/lab-sensor-applet-interface-dist' do
# so no cache headers aren't added to the jars
run Rack::Directory.new PUBLIC_PATH + "/lab/jars/lab-sensor-applet-interface-dist"
end
map '/' do
use Rack::LiveReload
require "rack-nocache"
use Rack::Nocache
use Rack::Static, :urls => [""], :root => PUBLIC_PATH , :index =>'index.html'
run Rack::Directory.new PUBLIC_PATH
end
else
run Rack::Directory.new PUBLIC_PATH
end