Skip to content

Instantly share code, notes, and snippets.

@44uk
Created February 18, 2015 16:10
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 44uk/78ec58d2c0035cba203e to your computer and use it in GitHub Desktop.
Save 44uk/78ec58d2c0035cba203e to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'webrick'
srv = WEBrick::HTTPServer.new(
:BindAddress => '127.0.0.1',
:Port => (port = ARGV[0].to_i) == 0 ? 3000 : port,
:DocumentRoot => './'
)
trap(:INT){srv.shutdown}
srv.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment