{"id":25451027,"url":"https://github.com/hng-12/number-classifier-golang","last_synced_at":"2025-06-13T10:09:00.229Z","repository":{"id":275731535,"uuid":"926997098","full_name":"HNG-12/number-classifier-golang","owner":"HNG-12","description":"Number Classifier API using the Go Programming Language.","archived":false,"fork":false,"pushed_at":"2025-02-04T11:56:33.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-13T10:04:52.670Z","etag":null,"topics":["gin-framework","golang","unit-testing"],"latest_commit_sha":null,"homepage":"","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/HNG-12.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,"zenodo":null}},"created_at":"2025-02-04T08:19:03.000Z","updated_at":"2025-02-04T11:56:36.000Z","dependencies_parsed_at":"2025-02-04T09:34:32.784Z","dependency_job_id":"91750648-0667-4dca-8ae2-e679a63e177e","html_url":"https://github.com/HNG-12/number-classifier-golang","commit_stats":null,"previous_names":["hng-12/number-classifier-golang"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HNG-12/number-classifier-golang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HNG-12%2Fnumber-classifier-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HNG-12%2Fnumber-classifier-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HNG-12%2Fnumber-classifier-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HNG-12%2Fnumber-classifier-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HNG-12","download_url":"https://codeload.github.com/HNG-12/number-classifier-golang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HNG-12%2Fnumber-classifier-golang/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259624737,"owners_count":22886330,"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":["gin-framework","golang","unit-testing"],"created_at":"2025-02-17T22:17:12.874Z","updated_at":"2025-06-13T10:09:00.205Z","avatar_url":"https://github.com/HNG-12.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Numbers Classifier API (Golang)\nThis is a simple API that classifies numbers into even or odd. It is written in Golang and uses the [Gin]()\n\n## Installation\n1. Clone the repository\n```bash\ngit clone https://github.com/HNG-12/number-classifier-golang.git\n```\n2. Change into the project directory\n```bash\ncd number-classifier-golang\n```\n3. Run the following command to install the dependencies\n```bash\ngo mod download\n```\n4. Run the following command to start the server\n```bash\ngo run main.go\n```\n\n## Usage\nThe API has only one endpoint which is a GET request to `/api/classify-number`. The request body should be a JSON object with a key `number` and a value of the number to be classified. The response will be a JSON object with a key `result` and a value of either `even` or `odd`.\n\nExample request:\n```bash\ncurl -X GET \"http://localhost:8080/api/classify-number?number=666\"\n```\n\nResponse (Success Response):\n```json\n{\n  \"number\":666,\n  \"is_prime\":false,\n  \"is_perfect\":false,\n  \"properties\":[\"even\"],\n  \"digit_sum\":18,\n  \"fun_fact\":\"666 is the largest rep-digit triangular number.\"\n}\n```\n\nResponse (Error Response):\n```json\n{\n  \"number\":\"abc\",\n  \"error\":true\n}\n```\n\n## Project Structure\nThe project is structured as follows:\n```bash\nnumber-classifier-golang\n├── main.go\n├── go.mod\n├── go.sum\n├── README.md\n└── handlers\n    └── number_classifier.go\n├── utils\n    └── number_classifier.go\n├── models\n    └── number_classifier.go\n├── routes\n    └── number_classifier.go\n├── middlewares\n    └── number_classifier.go\n├── tests\n    └── number_classifier_test.go\n```\n\n## Testing\nTo run the tests, run the following command:\n```bash\ngo test ./...\n```\n\n## Contributing\n1. Fork this repository\n2. Clone the forked repository\n3. Create your feature branch\n4. Commit your changes\n5. Push to the branch\n6. Create a new Pull Request\n7. Wait for your PR to be reviewed\n8. Merge your PR\n9. Congratulations 🎉","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhng-12%2Fnumber-classifier-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhng-12%2Fnumber-classifier-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhng-12%2Fnumber-classifier-golang/lists"}