End-to-End Routing

End-to-end application routing is the magic that allows us to leverage the benefits of the classic web application architecture along with the benefits of the single page application architecture. When implementing modern web applications, we have to strike a balance between satisfying the needs of two distinct audiences—humans and machines.

Let's first consider the experience from the human user's perspective. When a human user directly accesses the About page that we demonstrated in the previous chapter, template rendering is initially performed on the server side. This provides an initial page load that is perceived to be fast by the human user, since the web page content is readily available. This is the hallmark of the classic web application architecture. A different approach was taken for subsequent user interactions with the website. When the user clicked on the link to the About page from the navigation menu, template rendering was performed on the client side without the need of a full page reload, allowing for a more smooth and fluid user experience. This is the hallmark of the single page application architecture.

Machine users consist of the the various search engine bot crawlers that periodically visit the website. As you learned in the Chapter 1, Isomorphic Web Applications with Go, single page applications, are primarily not search-engine friendly since the vast majority of search engine bots don't have the intelligence to traverse them. Traditional search engine bots are accustomed to parsing well-formed HTML markup that has already been rendered. It's much more difficult for the bots to be trained to parse through the JavaScript that is used to implement the single page application architecture. If we want greater search engine discoverability, we must satisfy the needs of our machine audience.

The goal of striking the balance between fulfilling the needs of these two distinct audiences is the essence of isomorphic web applications. We will learn how to accomplish this goal, in this chapter, while we implement the product-related pages of IGWEB.

In this chapter, we will cover the following topics:

  • Routing perspectives
  • The design of the product-related pages
  • Implementing product-related templates
  • Modeling product data
  • Accessing product data
  • Registering server-side routes with Gorilla Mux
  • Server-side handler functions
  • Registering client-side routes with the isokit router
  • Client-side handler functions
  • Rest API endpoints
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.202.209