O'Reilly logo

Instant Sinatra Starter by Joe Yates

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

Quick start – your first Sinatra application

In this section, we're going to put together the basics of a simple address book application and deploy it. We'll be handling requests and returning a dynamically created page.

Step 1 – creating the application

The first thing to do is set up Sinatra itself, which means creating a Gemfile.

  1. Open up a Terminal window and navigate to the directory where you're going to keep your Sinatra applications.
  2. Create a directory called address-book using the following command:
    mkdir address-book
    
  3. Move into the new directory:
    cd address-book
    
  4. Create a file called Gemfile:
    source 'https://rubygems.org'
    
    gem 'sinatra'
    
  5. Install the gems via bundler:
    bundle install
    

    You will notice that Bundler will not just install the sinatra ...

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