diff --git a/src/webhooksd.cr b/src/webhooksd.cr index 7a0a158..569434f 100644 --- a/src/webhooksd.cr +++ b/src/webhooksd.cr @@ -1,5 +1,6 @@ require "http/server" require "option_parser" +require "./payload.cr" VERSION = 0.1 port = 3000 @@ -22,12 +23,13 @@ OptionParser.parse do |parser| end server = HTTP::Server.new do |context| - pp context.request if context.request.method != "POST" || context.request.path != "/" context.response.status = HTTP::Status::NOT_FOUND else + payload = Payload.new(context.request) + context.response.content_type = "text/plain" - context.response.print "Hello world! The time is #{Time.local}" + context.response.print payload.to_json end end