Day 2: Creating Views
We’ve completed a Sinatra web application that provides a basic RESTful API for managing bookmarks. This is a terrific achievement, but it would be even better with a user interface.
Although Sinatra works great for creating a RESTful API, it is not limited in that respect. You can also produce HTML pages quite easily, and that is what we’ll do today. You can choose among many libraries for templating HTML and use them from within Sinatra. We’ll look at three of them: ERB, Mustache, and Slim.
ERB comes with Sinatra and is easy to use. Mustache is an interesting choice if you prefer to have less syntax and no logic in your view templates. Slim is even more concise because it generates HTML tags for you. With these three engines, ...