From 29b56c35a5fd2305268a8ebb1448c9877173f0bb Mon Sep 17 00:00:00 2001 From: DaichiSaito Date: Wed, 21 Apr 2021 09:57:20 +0900 Subject: [PATCH] =?UTF-8?q?add=20=E5=8B=95=E7=9A=84=E3=83=9A=E3=83=BC?= =?UTF-8?q?=E3=82=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrick.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webrick.rb b/webrick.rb index 6fcbe83..ab2c3cf 100644 --- a/webrick.rb +++ b/webrick.rb @@ -7,4 +7,14 @@ :Port => 8000 }) +server.mount_proc("/time") do |req, res| + # レスポンス内容を出力 + body = "\n" + body += "#{Time.new}" + body += "\n" + res.status = 200 + res['Content-Type'] = 'text/html' + res.body = body +end + server.start