From 9974cadb4e5d6c01632f75dba4234db7668b65fa Mon Sep 17 00:00:00 2001 From: luneko Date: Wed, 29 Dec 2021 01:48:15 +0100 Subject: [PATCH] added basic http server --- src/kotatsu.cr | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/kotatsu.cr b/src/kotatsu.cr index 260a221..49876c8 100644 --- a/src/kotatsu.cr +++ b/src/kotatsu.cr @@ -1,6 +1,7 @@ # TODO: Write documentation for `Kotatsu` require "option_parser" +require "http/server" module Kotatsu VERSION = "0.1.0" @@ -18,4 +19,14 @@ module Kotatsu exit end end + + webserv = HTTP::Server.new do |context| + context.response.content_type = "text/plain" + context.response.print "Running kotatsu #{VERSION}" + end + + webaddr = webserv.bind_tcp 8080 + puts "Started kotatsu webserver on #{webaddr}" + webserv.listen + end