-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ru
47 lines (39 loc) · 1.04 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
44
45
46
47
require 'rack/websocket'
require './load.rb'
use Rack::Session::Cookie, :key => 'rack.session',
:path => '/websocket',
:expire_after => 2592000,
:secret => 'que_eh_isso'
use Rack::Static,
:urls => ["js"],
:root => "client"
app = Application.new
app.add_c ChatController.new(app)
app.add_c SetNickController.new(app)
app.add_c RoomsController.new(app)
app.add_c PregameController.new(app)
app.add_c DefinitionsController.new(app)
app.add_c GameController.new(app)
map '/websocket' do
conn = ServerConnection.new(app)
sessioned = Rack::Session::Pool.new(conn,
:domain => 'localhost',
:expire_after => 2592000)
run sessioned
end
map '/client' do
f = File.expand_path(File.dirname(__FILE__)) + '/client/'
run Rack::File.new(f)
end
map '/' do
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('client/index.html', File::RDONLY)
]
}
end