forked from anildigital/ruby-operators
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ru
More file actions
52 lines (43 loc) · 771 Bytes
/
Copy pathconfig.ru
File metadata and controls
52 lines (43 loc) · 771 Bytes
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
44
45
46
47
48
49
50
51
52
use Rack::Static,
:urls => ["/images", "/js", "/css", "/config"],
:root => "public"
class RubyOperators
def initialize
@app = Rack::Builder.new do
map '/' do
run Index.new
end
map '/app.html' do
run App.new
end
end
end
def call(env)
@app.call(env)
end
end
run RubyOperators.new
class Index
def call(env)
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('public/index.html', File::RDONLY)
]
end
end
class App
def call(env)
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('public/app.html', File::RDONLY)
]
end
end