Created
April 3, 2011 09:40
-
-
Save radityopw/900321 to your computer and use it in GitHub Desktop.
server.rb
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 'webrick' | |
include WEBrick | |
port = 8090 | |
if ARGV.length > 0 then | |
port = ARGV[0] | |
end | |
# Create an HTTP server | |
s = HTTPServer.new( | |
:Port => port, | |
:DocumentRoot => File.expand_path(File.dirname(__FILE__)) | |
) | |
# When the server gets a control-C, kill it | |
trap("INT"){ s.shutdown } | |
# Start the server | |
s.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment