{"id":18936351,"url":"https://github.com/shellbear/leboncoin","last_synced_at":"2025-08-03T03:07:13.854Z","repository":{"id":119546460,"uuid":"391000455","full_name":"shellbear/leboncoin","owner":"shellbear","description":"Technical test for Leboncoin","archived":false,"fork":false,"pushed_at":"2021-07-30T11:47:53.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T21:25:50.987Z","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/shellbear.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-30T09:05:04.000Z","updated_at":"2021-07-30T11:47:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d414def-c362-42eb-9469-ca1df4e74982","html_url":"https://github.com/shellbear/leboncoin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellbear%2Fleboncoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellbear%2Fleboncoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellbear%2Fleboncoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellbear%2Fleboncoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellbear","download_url":"https://codeload.github.com/shellbear/leboncoin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239937701,"owners_count":19721482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-08T12:07:05.572Z","updated_at":"2025-02-21T00:48:29.679Z","avatar_url":"https://github.com/shellbear.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leboncoin\n\nTechnical test for [Leboncoin](https://leboncoingroupe.com/).\n\nWeb API written in Go.\n\n## Objective\n\nYour goal is to implement a web server that will expose a REST API endpoint that:\n- [x] Accepts five parameters: three integers int1, int2 and limit, and two strings str1 and str2.\n- [x] 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.\n\nThe server needs to be:\n- [x] Ready for production\n- [x] Easy to maintain by other developers\n\nBonus: add a statistics endpoint allowing users to know what the most frequent request has been. This endpoint should:\n- [x] Accept no parameter\n- [x] Return the parameters corresponding to the most used request, as well as the number of hits for this request\n\n\n## 💻 Getting started \n\nUsing go cli:\n```bash\n$ go run .\n⇨ http server started on [::]:8080\n````\n\nUsing Docker:\n```bash\n$ docker build -t leboncoin .\n$ docker run -p 8080:8080 leboncoin\n```\n\nThis will expose an HTTP web server on the 8080 port.\n\nYou can access it with this URL: http://127.0.0.1:8080/\n\n## REST Endpoints\n\n### GET /\n\nReturns a list of strings with numbers from 1 to limit, where:\n- all multiples of int1 are replaced by str1 \n- all multiples of int2 are replaced by str2\n- all multiples of int1 and int2 are replaced by str1str2\n\n#### URL parameters\n\n- `int1` integer\n- `int2` integer\n- `limit` integer\n- `str1` string\n- `str2` string\n\n#### Example\n\n```bash\n$ export INT1=3 INT2=5 LIMIT=10 STR1=fizz STR2=buzz\n$ curl \"http://127.0.0.1:8080/?int1=$INT1\u0026int2=$INT2\u0026limit=$LIMIT\u0026str1=$STR1\u0026str2=$STR2\"\n[\"1\",\"2\",\"fizz\",\"4\",\"buzz\",\"fizz\",\"7\",\"8\",\"fizz\",\"buzz\"]\n```\n\n### GET /metrics\n\nReturn the parameters corresponding to the most used request, as well as the number of hits for this request.\nMember key is constructed as the following: `int1_int2_limit_str1_str2`\n\n### Example\n\n```bash\n$ curl \"http://127.0.0.1:8080/metrics\"\n[\n  {\n    \"Score\": 1,\n    \"Member\": \"3_5_30_fizz_buzz\"\n  },\n  {\n    \"Score\": 2,\n    \"Member\": \"3_5_10_fizz_buzz\"\n  },\n  {\n    \"Score\": 3,\n    \"Member\": \"32_5_10_fizz_buzz\"\n  },\n  {\n    \"Score\": 11,\n    \"Member\": \"32_531_10_fizz_buzz\"\n  }\n]\n```\n\n## 🤖 CI\n\nA CI is running on every push thanks to [Github Actions](https://github.com/features/actions).\nThis CI contains a [lint](.github/workflows/lint.yml) and a [build](.github/workflows/build.yml) workflows.\n\nThat follows the best Go lint practices and test the build on every code changes.\n\n## ⚙️ Config\n\nYou can specify optional environment variables to change default server variables:\n\n- `PORT` The web endpoint listening port (default: `8080`)\n- `HOST` The web endpoint listening address (default: `0.0.0.0`)\n- `REDIS_URL` The redis URL to connect to (default: inmemory redis instance)\n\n## Credits\n\nMade by Antoine Ordonez.\n\nWebsite: https://shellbear.me","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellbear%2Fleboncoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellbear%2Fleboncoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellbear%2Fleboncoin/lists"}