Chapter 7The Final Act

We’ve finished building our application now; it does everything it needs to do, so no more functionality will be added. This chapter is all about making our app more maintainable by switching to a modular structure. We’ll look at how to create a modular-style application in Sinatra and discuss the benefits of doing so. I will demonstrate this by separating the website and song files into separate modules, and use Rack to route the URLs to the correct module.

We’ll cover how easy it is to use Sinatra to create Rack middleware applications that can be used in other Sinatra applications, as well as other Rack-based frameworks such as Ruby on Rails. To demonstrate this, we’ll create our own asset handler middleware to help ...

Get Jump Start Sinatra now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.