Chapter 4 Setting up to Go Live

In the last chapter, we created a Song model and database table to store the songs in. We also created a web front end for creating, reading, editing, and deleting them.

In this chapter, we’ll look at the different settings that are available in Sinatra and learn how to configure an application. We’ll also address using sessions and discover how they can be employed to create a simple login system. Later, we’ll cover deploying our application live on the Internet using the Heroku service.

Configuration

Any configuration options for a Sinatra application can be set in a configure block:

configure do
  #configuration options go here
end

Code inside this block is run only once at startup. You can have ...

Get Jump Start Sinatra now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.