{"id":25865348,"url":"https://github.com/villaleo/calculator","last_synced_at":"2026-06-09T03:01:54.515Z","repository":{"id":279886095,"uuid":"939032702","full_name":"villaleo/calculator","owner":"villaleo","description":"A lightweight, stateless REST API to perform basic arithmetic operations.","archived":false,"fork":false,"pushed_at":"2025-03-27T22:22:40.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T23:25:52.536Z","etag":null,"topics":["go","http","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/villaleo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-02-25T22:09:17.000Z","updated_at":"2025-03-27T22:22:48.000Z","dependencies_parsed_at":"2025-02-28T09:45:48.472Z","dependency_job_id":"d6dda5a1-ee5d-4df3-8bbf-ef05dc72fc57","html_url":"https://github.com/villaleo/calculator","commit_stats":null,"previous_names":["villaleo/calculator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/villaleo/calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/villaleo%2Fcalculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/villaleo%2Fcalculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/villaleo%2Fcalculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/villaleo%2Fcalculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/villaleo","download_url":"https://codeload.github.com/villaleo/calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/villaleo%2Fcalculator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34089329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["go","http","rest-api"],"created_at":"2025-03-02T01:34:36.393Z","updated_at":"2026-06-09T03:01:54.510Z","avatar_url":"https://github.com/villaleo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📟 Calculator API\n\nA lightweight, stateless REST API to perform basic arithmetic operations.\n\n## 🚀 Features\n\n- [x] Perform **addition, subtraction, multiplication, and division** on two numbers.\n- [x] Sum an array of numbers.\n- [x] Supports floating point numbers.\n- [x] Handles errors gracefully.\n- [x] Middleware attaches a request ID to each incoming request.\n\n### 👷🏽‍♂️ Future Features\n\n- [ ] Add in rate limiter to prevent misuse of the API.\n- [ ] Add in token authentication to prevent unauthorized users from using the API.\n- [ ] Add in a database to keep track of all of the calculations that have taken place.\n- [ ] Create an associated http client that can work with the Calculator API.\n- [ ] Create a frontend that makes use of the API.\n\n## 📡 Base URL\n\n\u003chttp://localhost:8080\u003e\n\n## 📖 API Endpoints\n\n### Add Two Numbers\n\n**Endpoint:**\n\n```http\nPOST /add\n```\n\n**Request Body:**\n\n```json\n{\n  \"x\": 10.34,\n  \"y\": 45\n}\n```\n\n**Response:**\n\n```json\n{\n  \"interpretation\": \"10.34 + 45\",\n  \"result\": 55.34\n}\n```\n\n### Subtract Two Numbers\n\n**Endpoint:**\n\n```http\nPOST /subtract\n```\n\n**Request Body:**\n\n```json\n{\n  \"x\": 10.34,\n  \"y\": 45\n}\n```\n\n**Response:**\n\n```json\n{\n  \"interpretation\": \"10.34 - 45\",\n  \"result\": -34.66\n}\n```\n\n### Multiply Two Numbers\n\n**Endpoint:**\n\n```http\nPOST /multiply\n```\n\n**Request Body:**\n\n```json\n{\n  \"x\": 10.34,\n  \"y\": 45\n}\n```\n\n**Response:**\n\n```json\n{\n  \"interpretation\": \"10.34 * 45\",\n  \"result\": 465.3\n}\n```\n\n### Divide Two Numbers\n\n**Endpoint:**\n\n```http\nPOST /divide\n```\n\n**Request Body:**\n\n```json\n{\n  \"x\": 10,\n  \"y\": 2\n}\n```\n\n**Response:**\n\n```json\n{\n  \"interpretation\": \"10 / 2\",\n  \"result\": 5\n}\n```\n\n### Sum an Array of Numbers\n\n**Endpoint:**\n\n```http\nPOST /sum\n```\n\n**Request Body:**\n\n```json\n{\n  \"numbers\": [2, 5, -10, 32.5, -8]\n}\n```\n\n**Response:**\n\n```json\n{\n  \"interpretation\": \"2 + 5 - 10 + 32.5 - 8\",\n  \"result\": 21.5\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvillaleo%2Fcalculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvillaleo%2Fcalculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvillaleo%2Fcalculator/lists"}