Articles with the tag "web-development"

Using the Service Object Pattern in Go

Developing a web application without separating the logic used to parse an incoming request from the actual application logic can be painful. It is hard to test your card, dependencies aren't clear, and the code can become a mess. Learn how to apply the service object pattern to your Go code in order to properly isolate these concerns, making it easier to test, maintain, and read your code.

An Introduction to Templates in Go

This four part series explores Go's template package, which can be used to render HTML or text. Topics covered include contextual encoding, actions, using functions in templates, and how to build a proper view layer for a web application.

Pitfalls of context values and how to avoid or mitigate them in Go

Storing data in a context.Context, or as I refer to it - using context values, is one of the most contentious design patterns in Go. Storing values in a context appears to be fine with everyone, but what specifically should be stored as a context value receives a lot of heated discussion. I’ll be honest - when I started using them I used them in the naive and somewhat inappropriate way that everyone complains about.

Inserting records into a PostgreSQL database with Go's database/sql package

Learn to insert new records into a Postgres database using Go's database/sql package, along with how to get the resulting ID of newly created records.

Creating the V in MVC

Learn how to create a reusable view layer to simplify HTML rendering. This includes creating a shared layout, defining default templates that can be overridden, and including the same templates across various pages without putting all of the code into a single file.

Using Functions Inside Go Templates

Go's template package provides many useful built-in functions. Learn to use a few of the more common ones, as well as how to add custom fucntions to your templates so that you can add any functionality you need.

Avatar of Jon Calhoun
Articles and Tutorials by
Jon Calhoun

Jon Calhoun is a full stack web developer who teaches about Go, web development, algorithms, and anything programming. If you haven't already, you should totally check out his Go courses.

Previously, Jon worked at several statups including co-founding EasyPost, a shipping API used by several fortune 500 companies. Prior to that Jon worked at Google, competed at world finals in programming competitions, and has been programming since he was a child.

Recent Articles All Articles Mini-Series Progress Updates Tags About Me Go Courses

©2018 Jonathan Calhoun. All rights reserved.