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 to the Gemfile and run bundle install
:
gem 'haml', '4.0.6'
This will install the HAML gem.
Let's now add code to each of the routes and methods to the model wherever required. We will start in the order in which we have defined the routes.