Created
May 3, 2009 17:49
-
-
Save beccasaurus/106080 to your computer and use it in GitHub Desktop.
This file contains 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
# $ irb | |
>> require 'rack' | |
=> true | |
# to create and run a basic Rack application | |
>> Rack::Handler::Thin.run lambda {|e| [200, {}, ["Hello World!"]] } | |
Thin web server (v1.2.1 codename Asynctilicious Ultra Supreme) | |
Maximum connections set to 1024 | |
Listening on 0.0.0.0:8080, CTRL+C to stop | |
# goto http://localhost:8080 and you'll see your simple app | |
# want to run an app that comes out of the box with Rack that | |
# serves a directory of files and even shows directory listings, etc? | |
>> Rack::Handler::Thin.run Rack::Directory.new('/home/remi/some-dir') | |
Thin web server (v1.2.1 codename Asynctilicious Ultra Supreme) | |
Maximum connections set to 1024 | |
Listening on 0.0.0.0:8080, CTRL+C to stop | |
# goto http://localhost:8080 and you'll see all of the files | |
# in some-dir and .html files will be served up as HTML, | |
# images as images, etc etc :) | |
# to run the whole thing from BASH, you can: | |
# $ ruby -rrubygems -e "require 'rack'; Rack::Handler::Thin.run Rack::Directory.new('/home/remi/desktop')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment