540 views 17 secs 0 comments

Building and Testing a REST API in Go with Gorilla Mux and PostgreSQL

In General
March 18, 2020


Introduction

This tutorial will illustrate how you can build a REST API backed by PostgreSQL in Go, using Gorilla Mux for routing. The tutorial will employ test-driven development and will conclude by explaining how you can continuously test against a database during development.

Goals

By the end of this tutorial, you will:

  • Become familiar with Gorilla Mux, and
  • Learn how to test your application against a database with Continuous Integration (CI).

Prerequisites

This tutorial assumes:

  • Basic familiarity with Go and PostgreSQL, and
  • That you have working Go and PostgreSQL installations.

Introduction to the Application

Before we dive into the details, let’s take a brief look at the sample application we will be building as part of this tutorial.

What Will the Application Do?

The application will be a simple REST API server that will expose endpoints to allow accessing and manipulating ‘products’. The operations that our endpoint will allow…



Continue reading on source link

Leave a Reply
You must be logged in to post a comment.