Skip to content

Instantly share code, notes, and snippets.

@tejo
Created October 12, 2011 14:41
Show Gist options
  • Select an option

  • Save tejo/1281393 to your computer and use it in GitHub Desktop.

Select an option

Save tejo/1281393 to your computer and use it in GitHub Desktop.
instant webserver
require 'webrick'
require 'webrick/accesslog'
include WEBrick
require 'thread'
require 'pp'
root_dir = "./"
http_dir = File.expand_path(root_dir)
server = WEBrick::HTTPServer.new(
:BindAddress => "localhost",
:Port => 9090,
:DocumentRoot => http_dir,
:FancyIndexing => true
)
%w(INT).each do |signal|
trap(signal) { server.shutdown }
end
server.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment