Skip to content

Instantly share code, notes, and snippets.

@radityopw
Created April 3, 2011 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radityopw/900321 to your computer and use it in GitHub Desktop.
Save radityopw/900321 to your computer and use it in GitHub Desktop.
server.rb
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