Created
November 10, 2015 02:06
-
-
Save Andrelton/168c1244b8c92b045b36 to your computer and use it in GitHub Desktop.
Simple Rack app as a Ruby file instead of config.ru.
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
# Start server from command line with 'rackup hello_rack_app.rb' | |
# Make a GET request to the localhost port with cURL or your browser | |
require 'rack' | |
class Hello | |
def self.call(env) | |
[ | |
'200', | |
{ 'Content-type' => 'text/html' }, | |
['<h1>You made a Rack app!<h1>'] | |
] | |
end | |
end | |
Rack::Handler::WEBrick.run Hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment