Skip to content

jllovet/go-server-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

As I have been relearning Golang, I have been spending time studying how to build http servers. This repository is an attempt to synthesize lessons and patterns to help make building and managing http servers sensible and able to scale.

Another priority of mine is to build servers that can easily be compared to OpenAPI specs. At some point in the future, I may try to do this through code generation, such as with Oto or one of the many OpenAPI code generation tools. I believe that spec-first development empowers API-first development, which is a valuable way to build products and services in a way that all of the consumers of it - from developers to admins to end users - will be happy and more productive.

At the time of this initial writing, I am refraining from using code generation, because I want to make sure that I'm being intentional about each of the server components I'm using. If you have a recommendation about how to approach integrating a code-generation tool into this project, please open a Github Issue and let me know your thoughts.

Getting Started

Clone the repository.

Run the following to get a .env file to use.

cp .env_example .env

Using the default values there, you can spin up a server running on http://localhost:8080 by running

make build && make run

Acknowledgements

I'm heavily indebted to Mat Ryer for the ideas and patterns in this repository. He was a host of Go Time, has written copiously, and has given a number of talks. That said, I am not proceeding religiously with his suggestions, and there may be aspects of the template that he would agree with. I would love to know what you think about particular decisions, and I'd love to talk about alternatives. As he mentions in this episode of Go Time, his blog posts and talks are meant to be places to draw ideas from, not things to be followed to the letter. The patterns should only be used if they work for you.

About

matryer-inspired golang http server template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published