server.rb, and enter the following:
require 'rubygems' require 'sinatra' get '/' do "Hello World" end
The first two lines ensure we have access to Ruby's package manager, RubyGems, and the Sinatra library. The rest of file says that, when our server receives a GET request for the path
/, we should respond with the string Hello World.
ruby server.rb. You should see the following output:
== Sinatra/1.2.6 has taken the stage on 4567 for development with backup from Thin >> Thin web server (v1.2.7 codename No Hup) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:4567, CTRL+C to stop ...