In the new glorous website of Hanakai there are two “getting started” guides for Hanami: one for a “web app” (meaning, a fullstack app) and one for an API app. Even though those two guides follow building the same application (bookshelf), they differ quite a bit in places. Sometimes it’s absolutely justified (you don’t have HTML templates in API app), sometimes it feels justified, but can also provoke a thought. This is one of these thoughts. Let’s look about 30% in the guide at “Fetching books from database” subsection. It demonstrates how to get a books index page, paginated. This is how is looks for a fullstack app (combined into one listing for clarity): # action module Bookshelf module Actions module Home class Index < Bookshelf::Action def handle(request, response) end end end end end # view module Bookshelf module Views module Books class Index < Bookshelf::View include Deps["repos.book_repo"] expose :books do book_repo.all_by_title end end end end end # template <h1>Books</h1>…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.