# Description "The original fizz-buzz consists in writing all numbers from 1 to 100, and just replacing all multiples of 3 by ""fizz"", all multiples of 5 by ""buzz"", and all multiples of 15 by ""fizzbuzz"". The output would look like this: ""1,2,fizz,4,buzz,fizz,7,8,fizz,buzz,11,fizz,13,14,fizzbuzz,16,...""." Your goal is to implement a web server that will expose a REST API endpoint that: - Accepts five parameters: three integers int1, int2 and limit, and two strings str1 and str2. - Returns a list of strings with numbers from 1 to limit, where: all multiples of int1 are replaced by str1, all multiples of int2 are replaced by str2, all multiples of int1 and int2 are replaced by str1str2. The server needs to be: - Ready for production - Easy to maintain by other developers Bonus: add a statistics endpoint allowing users to know what the most frequent request has been. This endpoint should: - Accept no parameter - Return the parameters corresponding to the most used request, as well as the number of hits for this request # Deliverables ## Clarified specifications - `int1` and `int2` must be different and within the open interval `]1, limit[`. - non-specific integers are displayed as their unaligned base 10 representation - `str1` and `str2` must be valid path components as per [RFC 3986 §2.2]. - the fizzbuzz handler, as specified, is not REST, as it: - does not expose a representation of a resource, - only handles GET operations, - does not return links to provide navigation, so does not implement HATEOAS [RFC 3986 §2.2]: https://www.rfc-editor.org/rfc/rfc3986#section-2.2 ## Features - 100% S0 coverage on domain - features: - stats implemented as a JSON result - listen addr is overridable: - default: `:8080` - environment variable `FIZZBUZZ_ADDR` overrides default - flag `-addr` overrides environment variable Note: environment can be loaded from `.env` file: see `make serve`. ## Checklist - [X] Features coverage - [X] FizzBuzz++ handler - [X] Bonus features coverage - [X] Stats handler - [X] Test coverage - [X] Unit tests high on domain - [X] Fuzz tests on computations - [X] Integration tests on web handlers - [X] [12-factor] app - [X] VCS: Git - [X] Dependencies: `go.mod` - [X] Config in the environment ([envflag]) - [X] Backing services via URLs: none, not applicable - [X] Build, release, run: build with standard tools - [X] Stateless processes: handler is a pure function - [X] Port binding: `-addr` flag, `FIZZBUZZ_ADDR` env var - [X] Concurrency: processes supported by default - [X] Disposability: - clean server shutdown on `SIGTERM` - no state to save/restore - [X] Dev/prod parity: irrelevant in the context - [X] Logs to `stdout` (not `stderr`) - [X] Admin process: not applicable, nothing to administer [12-factor]: https://12factor.net/ [envrun]: https://github.com/dcowgill/envflag