{"id":28281346,"url":"https://github.com/dbelling/supermarket-api","last_synced_at":"2026-04-16T22:30:56.093Z","repository":{"id":88083247,"uuid":"210025184","full_name":"dbelling/supermarket-api","owner":"dbelling","description":"Golang Supermarket API","archived":false,"fork":false,"pushed_at":"2020-01-18T16:25:47.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-01T17:53:18.903Z","etag":null,"topics":["docker","golang","rest-api","travis-ci"],"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/dbelling.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":"2019-09-21T17:18:23.000Z","updated_at":"2020-01-18T16:25:49.000Z","dependencies_parsed_at":"2023-05-18T05:00:16.614Z","dependency_job_id":null,"html_url":"https://github.com/dbelling/supermarket-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dbelling/supermarket-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbelling%2Fsupermarket-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbelling%2Fsupermarket-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbelling%2Fsupermarket-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbelling%2Fsupermarket-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbelling","download_url":"https://codeload.github.com/dbelling/supermarket-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbelling%2Fsupermarket-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31907424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["docker","golang","rest-api","travis-ci"],"created_at":"2025-05-21T11:16:46.192Z","updated_at":"2026-04-16T22:30:56.063Z","avatar_url":"https://github.com/dbelling.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supermarket API\n\nIncluded is a [REST-ful](https://restfulapi.net/) API for a Supermarket written in Golang. Upon startup, the API is initialized with the following data:\n\n```json\n[\n  {\n      \"ProduceCode\": \"A12T-4GH7-QPL9-3N4M\",\n      \"Name\": \"Lettuce\",\n      \"UnitPrice\": \"3.64\"\n  },\n  {\n      \"ProduceCode\": \"E5T6-9UI3-TH15-QR88\",\n      \"Name\": \"Peach\",\n      \"UnitPrice\": \"2.99\"\n  },\n  {\n      \"ProduceCode\": \"YRT6-72AS-K736-L4AR\",\n      \"Name\": \"Green Pepper\",\n      \"UnitPrice\": \"0.79\"\n  },\n  {\n      \"ProduceCode\": \"TQ4C-VV6T-75ZX-1RMR\",\n      \"Name\": \"Gala Apple\",\n      \"UnitPrice\": \"3.59\"\n  }\n]\n```\n\nEach Food requires the following data:\n* ProduceCode - a 16 (kabob-cased) character string which only contains alphanumeric characters in each 4 character rune segment.\n* Name - name of the food. Must be included as a string in any request to create a food.\n* UnitPrice - unit price of the food, included as a stringified 2 digit precision float.\n\n## Supported Routes\n\n### Show\nIndex\n\n`GET /food`\n\nExample Request:\n```\ncurl --request GET \\\n  --url http://localhost:9000/food\n```\n\nExample Response:\n\n`200 - OK`\n```\n[\n  {\n      \"ProduceCode\": \"A12T-4GH7-QPL9-3N4M\",\n      \"Name\": \"Lettuce\",\n      \"UnitPrice\": \"3.64\"\n  },\n  {\n      \"ProduceCode\": \"E5T6-9UI3-TH15-QR88\",\n      \"Name\": \"Peach\",\n      \"UnitPrice\": \"2.99\"\n  },\n  {\n      \"ProduceCode\": \"YRT6-72AS-K736-L4AR\",\n      \"Name\": \"Green Pepper\",\n      \"UnitPrice\": \"0.79\"\n  },\n  {\n      \"ProduceCode\": \"TQ4C-VV6T-75ZX-1RMR\",\n      \"Name\": \"Gala Apple\",\n      \"UnitPrice\": \"3.59\"\n  }\n]\n```\nDetailed Show\n\nExample Request: \n\n`GET /food/{code}`\n\nExample Request:\n```\ncurl --request GET \\\n  --url http://localhost:9000/food/A12T-4GH7-QPL9-3N4M\n```\n\nExample Response:\n\n`200 - OK`\n```\n[\n  {\n      \"ProduceCode\": \"A12T-4GH7-QPL9-3N4M\",\n      \"Name\": \"Lettuce\",\n      \"UnitPrice\": \"3.64\"\n  },\n  {\n      \"ProduceCode\": \"E5T6-9UI3-TH15-QR88\",\n      \"Name\": \"Peach\",\n      \"UnitPrice\": \"2.99\"\n  },\n  {\n      \"ProduceCode\": \"YRT6-72AS-K736-L4AR\",\n      \"Name\": \"Green Pepper\",\n      \"UnitPrice\": \"0.79\"\n  },\n  {\n      \"ProduceCode\": \"TQ4C-VV6T-75ZX-1RMR\",\n      \"Name\": \"Gala Apple\",\n      \"UnitPrice\": \"3.59\"\n  }\n]\n```\n\nExample Response:\n\n### Create\n`POST /foods`\n\nExample Request:\n\n```\ncurl --request POST \\\n  --url http://localhost:9000/foods \\\n  --header 'content-type: application/json' \\\n  --data '{\n\t\"ProduceCode\": \"ABCD-1234-DEFG-7890\",\n\t\"Name\": \"Orange\",\n\t\"UnitPrice\": \"1.22\"\n}'\n```\n\nExample Response:\n\n`201 - Created`\n```\n[\n  {\n      \"ProduceCode\": \"ABCD-1234-DEFG-7890\",\n      \"Name\": \"Orange\",\n      \"UnitPrice\": \"1.22\"\n  }\n]\n```\n\nExample Request:\n```\ncurl --request POST \\\n  --url http://localhost:9000/foods \\\n  --header 'content-type: application/json' \\\n  --data '[\n\t{\n\t\t\"ProduceCode\": \"ABCD-1234-DEFG-7890\",\n\t\t\"Name\": \"Orange\",\n\t\t\"UnitPrice\": \"1.22\"\n\t},\n\t{\n\t\t\"ProduceCode\": \"DCBA-4321-GFED-9876\",\n\t\t\"Name\": \"Grapes\",\n\t\t\"UnitPrice\": \"3.45\"\n\t}\n]\n'\n```\n\nExample Response:\n`201 - Created`\n\nExample Response:\n```\n[\n  {\n\t\"ProduceCode\": \"ABCD-1234-DEFG-7890\",\n\t\"Name\": \"Orange\",\n\t\"UnitPrice\": \"1.22\"\n  },\n  {\n\t\"ProduceCode\": \"DCBA-4321-GFED-9876\",\n\t\"Name\": \"Grapes\",\n\t\"UnitPrice\": \"3.45\"\n  }\n]\n```\n\n### Delete\n`DELETE /foods/{code}`\n\nExample Request:\n\n```\ncurl --request DELETE \\\n  --url http://localhost:9000/foods/A12T-4GH7-QPL9-3N4M\n```\n\nExample Response:\n\n`204 - No Content`\n```\nNo Body\n```\n\n## Travis\nA Travis build configuration is also included here for the purpose of linting, testing and publishing the image to the [DockerHub repository](https://hub.docker.com/r/danbelling/supermarket-api).\n\n## Building the Docker Image\nThe included Dockerfile implements a [multi-stage process](https://docs.docker.com/develop/develop-images/multistage-build/) to produce a smaller image size. This uses the build flags `CGO_ENABLED` and `GOOS` to produce a minimal binary compatible with the Docker [scratch image](https://hub.docker.com/_/scratch).\n\n```\nCGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server .\ndocker build -t danbelling/supermarket-api .\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbelling%2Fsupermarket-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbelling%2Fsupermarket-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbelling%2Fsupermarket-api/lists"}