fff9yw
Last Updated: February 25, 2016
·
2.007K
· jurgelenas
Dark red pattern 512x512

Ruby web server one-liner

It is possible to launch a web server from command line in current directory not only with python one-liner, but with ruby too:

ruby -rwebrick -e's=WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start'
Say Thanks
Respond

4 Responses
Add your response

11313
2f8629fd72eb23d0e3db72474fcd8223

You can also do 'ruby -run -e httpd . -p 5000'

over 1 year ago ·
17964
5c6a407f3631fd3364d477a364bfd845

Also, no need to assign the server instance (you can forego the s=... bit.

over 1 year ago ·
17965
None

Nice. Also you can make it a little more concise using 1.9+ hash notation, as in Port: 3000 instead of :Port => 3000.

over 1 year ago ·
20827
None
over 1 year ago ·