Fizzbuzz exam project

Golang-fizzbuzz

Golang Fizzbuzz. This README is made up of two parts: the first one will give you basic instructions to easily install this application on your local device and be able to take part in the project. The other part is focused on our exercise.

Project README

Dependencies

Docker 20.10
Docker-compose 2.1
(Golang 1.17)

Project architecture

The project is built on top of this structure:

  • Application: Business actions layer
    • Command: DTO struct to verify the command required data
    • Handler: Service which handle command
  • Core: Application entry points
  • Driver: Connector interfaces
  • Infrastructure: External services layer
  • Presentation: External system interaction layer, here API entry points

First installation

Every needed environment variables are located in the .env file. The file is commited for the exercise so you can easily run the project, but I usually ignore it and provide a .env.example or .env.local commited file.

You can install project with:

$ make install

Access to your local service with the following ports:

  • HTTP API: 3000

Technical informations

You can update container for dev with:

$ make update

You can run test with:

$ make test || make test-cover

You can display app logs with:

$ make logs

You can have a bash command line interface with:

$ make cli

To get list of all command on your terminal:

$ make || make help

Simple API DOC

GET /fizzbuzz

5 query parameters accepted: int1 (int), int2 (int), limit (int), str1 (string), str2 (string)

Curl request example with query parameters:

$ curl --location --request GET 'localhost:3000/fizzbuzz?int1=3&int2=5&limit=100&str1=fizz&str2=buzz'

GET /statistic

No query parameters accepted

Curl request example:

$ curl --location --request GET 'localhost:3000/statistic'

Exam

The problematic of the exercise is technically focused on making a Golang API which provides JSON endpoints and can store data. I made for this project a simple architecture which allows you to easily maintain and expand it.

I chose to use net/http over gin-gonic/gin (or other) to run a vanilla http server and set up my own architecture (but I often use gin notably in a professional environment, which provides useful tools to bind JSON content for example).

I opted for redis to store our needed data which is a good and simple database caching (free / open source / fast and high performance) for our case. We can easily switch to another database storage by creating a new store infrastructure file (for PostgresSQL, MongoDB, Algolia, whatever we want) and updating the implementation on the concerned presentation.

I provided an alpine-golang Docker image with required test tools for development and a minimal Docker image that we can use for production. For development mode, notice that the make update command can be triggered at any moment or automatically by nodemon, air, hotswap or others.

To facilitate the environment variables management for the exercise I used the joho/godotenv dependency.

Owner
Similar Resources

Small proof of concept project to try temporal.io with Dispatch Incident Management from Netflix.

Small proof of concept project to try temporal.io with Dispatch Incident Management from Netflix.

temporal-dispatch-poc Small POC project to try out the Temporal workflow engine together with Netflix's Dispatch Incident Management System. Supported

Nov 12, 2021

Help to release a project which especially has multiple git repositories

This project aims to help to release a project which especially has multiple git repositories. Installation Install it to a Kubernetes cluster. You ca

Dec 15, 2022

Demo project which implements accumulative loyalty system

Gophermart Demo project which implements accumulative loyalty system POST /api/user/register — user registration; POST /api/user/login — user authenti

Mar 31, 2022

A sample golang project to demonstrate the integration with rancher pipeline

pipeline-example-go This is a sample golang project to demonstrate the integration with rancher pipeline. Building go build -o ./bin/hello-server Runn

Oct 30, 2021

The phylosophy behind readyGo is "A Simple configuration should give a working project.".

The phylosophy behind readyGo is

The phylosophy behind readyGo is "A Simple configuration should give a working project.". readyGo is a command line interface( probably the name of re

Oct 30, 2021

UCSD CSE 124 Fall 2021 Project 3 Starter Code

Surfstore This is the starter code for Module 3: Surfstore. Before you get started, make sure you understand the following 2 things about Go. (These w

May 15, 2022

A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Nov 10, 2021

Golang api for a league of legends teamfinder project

Golang api for a league of legends teamfinder project

League teamfinder API Golang api for a league of legends teamfinder project Table of Contents League teamfinder API Table of Contents Introduction Get

Nov 9, 2021

Project containing all scripts and descriptors to deploy Slurpanize in different ways

Slurpanize cloud infrastructure This project is built to install on any hardware or cloud infrastructure the Slurpanize platform. The installation is

Nov 24, 2021
Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Jan 10, 2022
A Go project template

Powered by Cookiecutter, Cookiecutter Golang is a framework for jumpstarting production-ready go projects quickly.

Dec 26, 2022
GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Sep 27, 2022
:guardsman: A teeny tiny and somewhat opinionated generator for your next golang project

A Yeoman Golang Generator We are very sorry Gophers, but other names for the generator where taken, so we choose go-lang. But we have gocreate as an a

Sep 27, 2022
Example programs for the Gio project.

Gio Examples Example programs for the Gio project. Issues File bugs and TODOs through the issue tracker or send an email to ~eliasnaur/[email protected].

Dec 20, 2022
Standard Go Project Layout
Standard Go Project Layout

This is a basic layout for Go application projects. It's not an official standard defined by the core Go dev team; however, it is a set of common historical and emerging project layout patterns in the Go ecosystem. Some of these patterns are more popular than others. It also has a number of small enhancements along with several supporting directories common to any large enough real world application.

Jan 3, 2023
bytecamp 2021 project

Calldiff 背景 复杂项目的日常迭代中,研发同学想了解某个改动的影响点,往往需要深入代码细节才能获得尽可能全的 checklist 。然而,由于项目的复杂性,我们获得的 checklist 又难免会有一些遗漏。 为了减轻研发同学的心智负担,辅助同学们更有效地保证服务稳定性,本项目应运而生。 本

Oct 4, 2021
This is an example of the cobra project

Devops cmd and mian.go This is an example of the cobra project Execute the following command in the current path to compile the project,you will appea

Sep 6, 2022
feedme project porting in Go language

newsapi-go This project has the intent to provide a valid interface for newsapi (https://newsapi.org/). usage The project is still under mantainance a

Oct 28, 2021
This is a simple project for demonstrating Temporal with the Go SDK.
This is a simple project for demonstrating Temporal with the Go SDK.

This is a simple project for demonstrating Temporal with the Go SDK.

Oct 11, 2021