Last active
December 22, 2022 02:21
-
-
Save kazuho/9539dc13699a0c9d208a2646f3988743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
counter = 0 | |
Thread.new do | |
loop do | |
puts "hello, #{counter}" | |
counter += 1 | |
sleep 1 | |
end | |
end | |
app = Proc.new do |env| | |
[200, {'Content-Type' => 'text/plain; charset=utf-8'}, [counter.to_s]] | |
end | |
Rack::Handler::WEBrick.run app, { | |
:Host => '127.0.0.1', | |
:Port => 8080, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
バージョン間で色々と踏んでる気配があるので、これだとどうでしょう?