summaryrefslogtreecommitdiff
path: root/new/lib/crys/server.rb
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-12-27 00:16:14 +0100
committermms <git@sapka.me>2024-12-27 00:16:14 +0100
commitd3316d0b042ffa550ff56ed4e691c80003dd1414 (patch)
treededf93e497bb3c95b5f952a79b13dc89d3670fcf /new/lib/crys/server.rb
parent9ff71af752746fd4d61e7b5a1f025b1943f60dea (diff)
feat(new): server mode
Diffstat (limited to 'new/lib/crys/server.rb')
-rw-r--r--new/lib/crys/server.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/new/lib/crys/server.rb b/new/lib/crys/server.rb
new file mode 100644
index 0000000..aa0c19c
--- /dev/null
+++ b/new/lib/crys/server.rb
@@ -0,0 +1,21 @@
+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
+