Finally, update the routes.rb
file so our application parses the route and uses the controller action to generate the final view.
# config/routes.rb
require_relative '../router'
Router.draw do
get('/') { "Akshay's Blog" }
get '/articles/index'
end
That's it. We're done. Start the server and navigate to /articles/index
path, you should see this:
Now we could stop here. However, there's a small refactoring we could do to make the controller look more like Rails.
Let's extract the constructor to the base class.