Serve a local directory with WEBrick
It's easy to serve a local directory over HTTP with WEBrick. Just throw the following in your ~/.bash_profile or ~/.zshrc:
alias served="ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 9090, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start\""
Then cd to the directory you want to serve and type served. Point your browser to http://localhost:9090 and wala!
Gist at https://gist.github.com/1766379
Written by Eric Holmes
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#