How I write Go HTTP services after seven years

Last updated 193 days ago by Mat Ryer

golang

I’ve been writing Go (Golang when not spoken) since r59 — a pre 1.0 release — and have been building HTTP APIs and services in Go for the past seven years.

At Machine Box, most of my technical work involves building various APIs. Machine Learning is complicated and inaccessible to most developers, so my job is to tell a simple story through the API endpoints, and we’ve had great feedback so far.

If you haven’t witnessed the Machine Box developer experience yet, please give it a go and let me know what you think.

The way I have written services has changed over the years, so I wanted to share how I write the services today — in case the patterns are useful to you and your work.

A server struct

All of my components have a single server structure that usually ends up looking something like this:

Read full Article