▶Book Description
Isomorphic Go is the methodology to create isomorphic web applications using the Go programming language. Isomorphic web applications have the capability to reuse code across environments, increasing the synergy between the web server and the web browser. This book is a hands-on guide that will show you how to build and deploy an Isomorphic Go web application.
Isomorphic Go begins with an in-depth exploration of the benefits provided by the isomorphic web application architecture. You'll be introduced to the Isomorphic Go toolchain, and how it can help you write Go code that functions across environments. You'll learn how to create Go programs in the web browser using GopherJS and how to render isomorphic templates. Then you'll be introduced to end-to-end application routing, use isomorphic handoff to seamlessly transition state from the web server to the web browser, and compose isomorphic forms that have the ability to reuse form validation logic. You'll be exposed to advanced concepts including the implementation of real-time web application functionality with websockets and the creation of reusable components (cogs) that are rendered using the virtual DOM. Finally, you'll see how to deploy an Isomorphic Go web application to a production environment.
▶What You Will Learn
⦁ Create Go programs inside the web browser using GopherJS
⦁ Render isomorphic templates on both the client side and the server side
⦁ Perform end-to-end application routing for greater search engine discoverability and an enhanced user experience
⦁ Implement isomorphic handoff to seamlessly transition state between the web server and the web browser
⦁ Build real-time web application functionality with websockets
⦁ Create reusable components (cogs) that are rendered using the virtual DOM
⦁ Deploy an Isomorphic Go application for production use
▶Key Features
⦁ Learn how to build Isomorphic Go web applications
⦁ Neatly organize your isomorphic codebase to enhance the maintainability of your application
⦁ Leverage the same Go code across the web server and the web browser
▶Who This Book Is For
This book addresses readers who have had prior experience with the Go programming language and understand the language's essential concepts. It is also assumed that the reader has had prior experience with basic web development. No previous knowledge of isomorphic web application development is required. Since this book follows an idiomatic approach using Go, it is not necessary that the reader should have had prior experience using JavaScript or any tools or libraries within the JavaScript ecosystem.
▶What this book covers
⦁ Chapter 1, Isomorphic Web Applications with Go, presents the benefits of the isomorphic web application architecture and explains why Go makes a compelling choice for the creation of isomorphic web applications.
⦁ Chapter 2, The Isomorphic Go Toolchain, guides you through the process of installing the Isomorphic Go toolchain, introduces you to the IGWEB project, walks you through the project file structure, provides the project roadmap, and highlights some coding techniques used over the course of the book.
⦁ Chapter 3, Go on the Front-End with GopherJS, introduces you to programming with Go on the front-end using GopherJS. We show you how to perform basic DOM operations, change the CSS style property of elements, call built-in JavaScript functionality, make XHR calls,
encode data in the gob format, render inline templates, and create a local storage inspector.
⦁ Chapter 4, Isomorphic Templates, introduces the web template system consisting of the template engine, the template data object, and the template. It shows you how to organize templates based on their purpose. It explains the concept of isomorphic template rendering, and shows you how to create an in-memory template set that can be utilized across environments.
⦁ Chapter 5, End-to-End Routing, explains how to register server-side routes using the Gorilla Mux router, and also shows you how to register client-side routes using the isokit router. It also shows you how to create server-side Rest API endpoints that handle XHR requests.
⦁ Chapter 6, Isomorphic Handoff, introduces you to the concept of isomorphic handoff, the ability to pass state from the server to the client. It shows you how to implement isomorphic handoff using the ERDA (Encode-Register-Decode-Attach) strategy. It also shows you how to verify that isomorphic handoff has been implemented successfully.
⦁ Chapter 7, The Isomorphic Web Form, shows you how to build an accessible isomorphic web form, having the ability to share both form code as well as validation logic across environments. It shows you how to ensure that the form functions for web browsers that don't have a JavaScript runtime, and also shows you how to perform client-side form validation for web browsers that do.
⦁ Chapter 8, Real-Time Web Application Functionality, shows you how to implement real-time web application functionality in the form of a live chat feature. It shows you how to create a chat bot that can answer simple questions about Isomorphic Go. It also shows you how to gracefully shut down the feature if the internet connection is interrupted.
⦁ Chapter 9, Cogs –. Reusable Components, introduces you to cogs, reusable components that can be implemented either exclusively in Go (pure cogs) or with Go and JavaScript (hybrid cogs). It explains the anatomy of a cog by exploring its file structure. It also explains how cogs utilize a virtual DOM to render their contents in an efficient manner.
⦁ Chapter 10, Testing an Isomorphic Go Web Application, shows you how to implement automated end-to-end testing to verify the functionality of an Isomorphic Go web application. It shows you how to verify server-side functionality by implementing tests using Go's testing package. It shows you how to verify client-side functionality by implementing CasperJS tests to test multiple user interaction scenarios on the client-side.
⦁ Chapter 11, Deploying an Isomorphic Go Web Application, explains how an Isomorphic Go web application behaves in production mode. It shows you how to deploy an Isomorphic Go web application to a standalone server in the cloud. It also shows you how to deploy an
Isomorphic Go web application as a multi-container Docker application running in the cloud.
⦁ Appendix, Debugging Isomorphic Go, guides you through the process of debugging an Isomorphic Go web application. It shows you how to identify compiler/transpiler errors, examine panic stack traces, and trace code to pinpoint the source of issues.