Warning: Please note that the use of this project entails costs linked to the use of GCP, inquire before starting, for those who do not have a google account offers you $ 300 for a period of one year (to be checked accordingly of your conditions of use and their conditions of use and sales).
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,...".
Example for get request with the following parameters:
- int1: 3
- int2: 5
- limit: 20
- str1: fizz
- str2: buzz
curl -sX POST 127.0.0.1:8080/fizzbuzz -d '{"int1": 3, "int2": 5, "limit" : 20, "str1": "fizz", "str2":"buzz"}' | jq .
{"Items":["1","2","fizz","4","buzz","fizz","7","8","fizz","buzz","11","fizz","13","14","fizzbuzz","16","17","fizz","19","buzz"]}
Example for get the most frequent requested (refer to bonus section)
curl -sX GET "127.0.0.1:8080/fizzbuzz" | jq .
{
"Int1": "3",
"Int2": "5",
"Limit": "10",
"Str1": "fizz",
"Str2": "buzz",
"Requests": "2347358"
}
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:
- Kubernetes
- Develop on GCP
- LB & Availability
- Loadbalanced by GCP Loadbalancer, client and gateway is scalabled
- Monitoring: (cf. https://devopscube.com/setup-prometheus-monitoring-on-kubernetes/)
- Alerting
- Terraformed (for the best)
- Kubernetes
-
Easy to maintain by other developers:
- Linter : https://github.com/golangci/golangci-lint
- CI : https://circleci.com/docs/
- Fonctionnal
- Unit test (for the best)
- CD (for the best)
- Required to add registry in GCP
- Add variable in circle-ci for GCP access
- Changelog (for the best) : https://github.com/git-chglog/git-chglog
- 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