{"id":22018127,"url":"https://github.com/rvflash/fizzbuzz","last_synced_at":"2026-04-14T23:33:29.136Z","repository":{"id":57552626,"uuid":"141931531","full_name":"rvflash/fizzbuzz","owner":"rvflash","description":"FizzBuzz REST API over HTTPS (example)","archived":false,"fork":false,"pushed_at":"2018-07-24T18:04:50.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T21:49:53.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvflash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-22T21:20:06.000Z","updated_at":"2018-07-30T12:10:15.000Z","dependencies_parsed_at":"2022-09-26T18:50:43.954Z","dependency_job_id":null,"html_url":"https://github.com/rvflash/fizzbuzz","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rvflash/fizzbuzz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvflash%2Ffizzbuzz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvflash%2Ffizzbuzz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvflash%2Ffizzbuzz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvflash%2Ffizzbuzz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvflash","download_url":"https://codeload.github.com/rvflash/fizzbuzz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvflash%2Ffizzbuzz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31819795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T05:10:01.542Z","updated_at":"2026-04-14T23:33:29.119Z","avatar_url":"https://github.com/rvflash.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FizzBuzz\n\n[![GoDoc](https://godoc.org/github.com/rvflash/fizzbuzz?status.svg)](https://godoc.org/github.com/rvflash/fizzbuzz)\n[![Build Status](https://img.shields.io/travis/rvflash/fizzbuzz.svg)](https://travis-ci.org/rvflash/fizzbuzz)\n[![Code Coverage](https://img.shields.io/codecov/c/github/rvflash/fizzbuzz.svg)](http://codecov.io/github/rvflash/fizzbuzz?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/rvflash/fizzbuzz)](https://goreportcard.com/report/github.com/rvflash/fizzbuzz)\n\n\nFizzBuzz REST API over HTTPS (example).\n\nThis project offers 2 endpoints:\n* A simple [package](https://godoc.org/github.com/rvflash/fizzbuzz) to play with the original FizzBuzz or make your own one. Three algorithms are available.\n* A [REST API](https://github.com/rvflash/fizzbuzz/tree/master/cmd/fizzbuzz) over HTTPS to make your own FizzBuzz and get its responses as JSON.  \n \n \n## Installation\n\nFizzbuzz uses [dep](https://golang.github.io/dep/) to manage its dependencies.\nWaiting for Go Modules (code name: vgo), it's the tool to do this stuff!\n\n```bash\n$ go get github.com/rvflash/fizzbuzz\n$ cd $GOPATH/src/github.com/rvflash/fizzbuzz\n$ dep ensure\n```\n\n\n## Quick start\n\nIf you just need a Go package to play with Fizzbuzz, see this [documentation](https://godoc.org/github.com/rvflash/fizzbuzz) on the interface.\nThis package proposes 3 different methods to apply the algorithm. The benchmark's performances have defined the method to use in the API.  \n\n```go\nimport (\n\t\"fmt\"\n\t\"github.com/rvflash/fizzbuzz\"\n)\n// ...\nfb := fizzbuzz.Default\nfmt.Println(fb.Bulk(15))\n// output: [1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz]\n```\n\nOtherwise, to start the REST API, see the [cmd/fizzbuzz](https://github.com/rvflash/fizzbuzz/tree/master/cmd/fizzbuzz) for more information.\nAlso see, the [documentation](https://github.com/rvflash/fizzbuzz/tree/master/api) of the API handler.  \n\n\n## Dependencies\n\n### Gin\n\nOne of the best features of Go is its built-in net/http library.\nHowever, I wanted to use Gin for this project to simplify some parts of the code and used a non-standard package to use dep.\nAnd, it's a really fast alternative to build a micro-service like this one (see [Goa](https://github.com/goadesign/goa) for more complex projects).\n\n\n## Features\n\n* A package that exposes methods to play with FizzBuzz, with 3 different algorithms (see benchmark bellow).\n* A REST API over HTTPS to use it.\n* Continuous integration with [Travis](https://travis-ci.org/rvflash/fizzbuzz) that run all lints and tests (benchmark included). \n* Fully [tested](https://codecov.io/github/rvflash/fizzbuzz?branch=master) and code that passed various [linters](https://github.com/golangci/golangci-lint) (go vet, etc.)\n* A Systemd unit file to easily manage and control the service. The logs can be manipulated with Journalctl.\n* The API can recover on its own panics. Systemd will restart it for others cases (server reboot, etc).\n* The API exposes a health check as monitoring purpose.\n* Vendored dependencies with dep.\n* Semantic Versioning. The master branch, as usual with a Go project is not safe. To use in production, see the latest tag: v0.0.2.\n\n\n### TODO: possible improvements\n\n* Add a cache. As the result is deterministic, we can use a cache to speed up operations and store the API results.\n* Add the cache-control header to also cache the data on client-side (max-age).\n* Add the CORS headers (Access-Control-Allow-Origin, etc.) to make the API accessible by JavaScript in-browser client-side code.\n* Add a system, via NGINX or other, to redirect the HTTP traffic to the HTTPS API.\n* Add GZIP encoding to optimize the load time.\n\n\n## Testing\n\nAs usual:\n\n```bash\n$ go test -cover -race -v $(go list ./... | grep -v /vendor/)\n$ go test -bench=.\n```\n\n### Benchmark\n\n\u003e On Linux OS, the default algorithm used in API is even faster, see the [Travis logs](https://travis-ci.org/rvflash/fizzbuzz).\n\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/rvflash/fizzbuzz\nBenchmarkMultiples_One-4            \t20000000\t        61.6 ns/op\nBenchmarkMultiples_Two-4            \t20000000\t        59.3 ns/op\nBenchmarkMultiples_Three-4          \t30000000\t        51.7 ns/op\nBenchmarkMultiples_Bulk20-4         \t 2000000\t       719 ns/op\nBenchmarkMultiples_BulkTwo20-4      \t 2000000\t       749 ns/op\nBenchmarkMultiples_BulkThree20-4    \t 2000000\t       835 ns/op\nBenchmarkMultiples_Bulk100-4        \t  500000\t      3422 ns/op\nBenchmarkMultiples_BulkTwo100-4     \t  500000\t      3538 ns/op\nBenchmarkMultiples_BulkThree100-4   \t  300000\t      3950 ns/op\nPASS\nok  \tgithub.com/rvflash/fizzbuzz\t15.906s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvflash%2Ffizzbuzz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvflash%2Ffizzbuzz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvflash%2Ffizzbuzz/lists"}