Skip to content

Instantly share code, notes, and snippets.

@Andrelton
Created November 10, 2015 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrelton/168c1244b8c92b045b36 to your computer and use it in GitHub Desktop.
Save Andrelton/168c1244b8c92b045b36 to your computer and use it in GitHub Desktop.
Simple Rack app as a Ruby file instead of config.ru.
# 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