hands-on lab

Creating a Microservice in Go - Part 1

Up to 1h 30m
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


You have a small collection of retro video games and you want to build a microservice API to manage them. In the spirit of microservices, you want to keeping the code base to one entity, games. This microservice will provide functionality to create, get, view, and delete a game entity. Within this lab, you will implement the functionality to create and view these entities. It will also be RESTFUL (reading and writing JSON), and provide endpoints to return a collection of games.

Learning Objectives

Upon completion of this lab you will be able to:

  • Understand Go code basics of creating a web server and connecting to a database
  • Implement web server code and SQL code to create entities in a database
  • Implement web server code and SQL code to retrieve entities from a database

Intended Audience

This lab is intended for:

  • Developers, especially those working with Go
  • Anyone leveraging containers


You should possess:

  • Basic understanding of the Go programming language
  • Familiarity with basic SQL commands
  • Understanding of the Linux command line
  • Experience with JSON and CRUD APIs is recommended but not required

The following content is sufficient to fulfill these prerequisites:


October 4th, 2021 - Made the command to rebuild and run the api server explicit in the Retrieving Data From the Database lab step

August 15th, 2021 - Increased lab duration

May 26th, 2021 - Added instructions to include imports in the handler.go file as needed when they are not automatically added

About the author

Learning paths

Calculated Systems was founded by experts in Hadoop, Google Cloud and AWS. Calculated Systems enables code-free capture, mapping and transformation of data in the cloud based on Apache NiFi, an open source project originally developed within the NSA. Calculated Systems accelerates time to market for new innovations while maintaining data integrity.  With cloud automation tools, deep industry expertise, and experience productionalizing workloads development cycles are cut down to a fraction of their normal time. The ability to quickly develop large scale data ingestion and processing  decreases the risk companies face in long development cycles. Calculated Systems is one of the industry leaders in Big Data transformation and education of these complex technologies.

Covered topics

Lab steps

Connecting to the Go Development Environment
Testing the Go API Server
Understanding the Database and Data
Understanding the Routing, Handlers, and Web Server
Implementing the CREATE Operation
Retrieving Data From the Database
Retrieving All the Games