Summary

In this chapter, we implemented end to end application routing for IGWEB as we built the products-related pages. We started by registering server-side routes using the Gorilla Mux router. We associated each route with a corresponding, server-side route handler function that would service the server-side route. We then examined the implementation of the server-side route handler functions for the product-related pages.

Having satisfied the needs of implementing the classic web application architecture for the initial page load, we moved on to the client side by first registering routes for the product-related pages, using the isokit router. Just as we had done on the server side, we associated each client-side route with a corresponding client side route handler function that would service the client-side route. You learned how to implement client-side route handlers and how to make XHR calls from them to server-side Rest API endpoints. Finally, you learned how to create server-side Rest API endpoints that handled XHR requests and returned JSON data to the client.

The product-related pages had a persistent state since the list of available products where driven by the contents of the datastore. How do we maintain state in a situation where the user interaction with the website changes the given state? For example, if the user added items to the shopping cart, how can we go about maintaining the state of the shopping cart and syncing it up between the server side and the client side? You are going to learn about isomorphic handoff, the process of handing off state between the server and the client in Chapter 6Isomorphic Handoff. We will implement the shopping cart functionality for the website in the process of doing this.

..................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