O'Reilly logo

Learning Sinatra by Manoj Sehrawat, Sudeep Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Hello World

Now that we are confident with Ruby, let's get into action and start writing an application. Make sure that you have Ruby installed. We will get a basic skeleton app up and running and see how to structure the application.

In this chapter, we will discuss the following topics:

  • A project that we will use to understand Sinatra
  • The Bundler gem
  • The file structure of the application
  • Responsibilities of each file

Before we begin writing our application, let's write the Hello World application.

Getting started

We have seen the Hello World program in the first chapter:

1 require 'sinatra'
2
3 get '/' do
4   return 'Hello World!'
5 end

We have also discussed how this code works:

ruby helloworld.rb

Executing this from the command line will run ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required