Class: Bezel::ServerConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/server_connection.rb

Class Method Summary collapse

Class Method Details

.start(port = 3000) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/server_connection.rb', line 9

def self.start(port = 3000)
  DBConnection.open

  asset_app = Proc.new do |env|
    req = Rack::Request.new(env)
    res = Rack::Response.new
    ROUTER.run(req, res)
    res.finish
  end

  app = Rack::Builder.new do
    use Bezel::StaticAssets
    run asset_app
  end

  Rack::Server.start(
    app: app,
    Port: port
  )
end