O'Reilly logo

Isomorphic Go by Kamesh Balasubramanian

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing pure cogs

Now that we have a basic understanding of cogs, its time to implement a few cogs in practice. Although cogs operate on the client-side, it is important to note that the server-side application needs to acknowledge their existence by registering them. Code for cogs are strategically placed in the shared/cogs folder for this reason. 

Pure cogs are implemented exclusively in Go. As you will see, we can leverage functionality from existing Go packages to implement cogs.

Inside the main function in the igweb.go source file, we call the initailizeCogs function passing in the application's template set:

initializeCogs(env.TemplateSet)

The initializeCogs function is responsible for initializing all the cogs that are going to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required