Skip to content

Instantly share code, notes, and snippets.

@colorqualia
Created April 23, 2013 15:25
Show Gist options
  • Save colorqualia/5444510 to your computer and use it in GitHub Desktop.
Save colorqualia/5444510 to your computer and use it in GitHub Desktop.
WEBrick Server
require 'webrick'
include WEBrick
WEBrick::HTTPUtils::DefaultMimeTypes.store 'svg', 'image/svg+xml'
server = WEBrick::HTTPServer.new({
:DocumentRoot => './',
:BindAddress => '0.0.0.0',
:Port => 8000
})
['INT', 'TERM'].each {|signal|
Signal.trap(signal){ server.shutdown }
}
server.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment