summaryrefslogtreecommitdiff
path: root/new/lib/crys/server.rb
blob: cc43b396eb542bb2cf45c4b26b20a0823df7cead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'webrick'
module Crys
  class Server
    def initialize(root:)
      @root = root
    end

    def start
      server = WEBrick::HTTPServer.new Port: 8000, DocumentRoot: root
      trap 'INT' do
        server.shutdown
      end

      server.start
    end

    private

    attr_reader :root
  end
end