Last active
December 11, 2015 23:08
-
-
Save tatat/4674541 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'webrick' | |
server = WEBrick::HTTPServer.new( | |
:DocumentRoot => '.', | |
:Port => (ARGV[0] || '3001').to_i, | |
:MimeTypes => WEBrick::HTTPUtils::DefaultMimeTypes.merge({ | |
'js' => 'application/javascript' | |
}) | |
) | |
[:INT, :TERM].each do |signal| | |
trap signal do | |
STDERR.puts "GOT SIG#{signal.to_s.upcase}" | |
server.shutdown | |
end | |
end | |
server.start |
This file contains hidden or 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
python -m SimpleHTTPServer 3001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment