Class: Staticz::Server

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

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/server.rb', line 6

def initialize
  puts "Starting server..."

  app = Rack::Builder.new do
    map "/" do
      run Rack::Directory.new("build")
    end
  end

  thin_server = Thin::Server.new '127.0.0.1', 3000
  thin_server.app = app

  puts "Building..."
  Staticz::Builder.new

  Thread.new { listen_to_file_changes }
  thin_server.start
end