WhitneyLampkin / go-server-example

Go Server Example Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Server Example

Build Status Man Hours

This is an example project to show how to setup a simple go server that produces either a webpage or an API endpoint of data. Currently data is generated with mockaroo and that data is stored in a CSV file under data, this information is stored in a slice for quick access of in memory data.

Recent Additions

  • Metrics Exposure and scrapping via prometheus server
  • Logging via file and injection pipeline with FileBeat, Elastic, and Kibana
  • Tracing with jaeger and opentracing
  • Kubernetes deployment example
  • Routing on 404 and home redirect
  • CRUD actions for mock user data
  • Streamline Main Server and Router setup
  • Add config file based startup sequence

Tech

The specific goal of this project was to teach a basic structure for a golang application and the surrounding components to productionalize the service. Using as many native golang libraries and very few 3rd party libraries the project is meant to be easily understood and clear from the start.

  • Golang
  • Docker
  • TravisCI

Installation

The server requires Go to run. Once golang has been installed, run make command to start service.

$ make

This will start the server on localhost:8080, which you can navigate to using your browser to access.

For production environments...

$ make docker
$ docker run -e LOG_FILE=service-name --rm -d -p 8080:8080 IMAGE_TAG

Todos

  • Add End to End testing Example
  • Add database based DAO interface

License

MIT

About

Go Server Example Project

License:MIT License


Languages

Language:Go 62.1%Language:HTML 21.3%Language:Shell 9.1%Language:Makefile 6.2%Language:Dockerfile 1.3%