Sending the data and designing the views

We can divide the routes based on the type of HTTP requests that they handle (GET and POST). For all the GET requests, we might fetch some data from the backend and show an HTML page, and for all the POST requests, we will call a model method and return to the same HTML page. So, for now, we will just write the code to call an HTML page and design the actual pages later on.

To design the pages, we will use a templating engine called HAML. HAML is a ruby gem that makes it easier to write HTML codes. To make sure that our application doesn't throw any errors, we will install the HAML gem now and create empty files.

To install the gem, we will add it to the Gemfile and run bundle install. Add the following line ...

Get Learning Sinatra now with O’Reilly online learning.

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