Created
November 9, 2015 13:19
-
-
Save chrisseaton/69ceb3a2b885e7fcb179 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | |
# code is released under a tri EPL/GPL/LGPL license. You can use it, | |
# redistribute it and/or modify it under the terms of the: | |
# | |
# Eclipse Public License version 1.0 | |
# GNU General Public License version 2 | |
# GNU Lesser General Public License version 2.1 | |
require 'webrick' | |
server = WEBrick::HTTPServer.new(Port: 8000) | |
requests_served = 0 | |
server.mount_proc '/hello' do |req, res| | |
res.status = 200 | |
res['Content-Type'] = 'text/plain' | |
requests_served += 1 | |
res.body = "Hello, World! #{requests_served}" | |
server.shutdown if requests_served == 10_000 | |
puts requests_served | |
end | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment