{"id":21638284,"url":"https://github.com/w-ptra/spring_boot_crud_api","last_synced_at":"2026-05-09T07:04:17.310Z","repository":{"id":245717379,"uuid":"818994305","full_name":"W-ptra/Spring_Boot_CRUD_API","owner":"W-ptra","description":"A simple RESTful API built with Spring Boot application that performs Create, Read, Update, and Delete (CRUD) operation on a \"Product\" table in MySQL database using JDBC Driver. ","archived":false,"fork":false,"pushed_at":"2024-06-27T12:17:11.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T04:26:13.443Z","etag":null,"topics":["java","jdbc-driver","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","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/W-ptra.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,"zenodo":null}},"created_at":"2024-06-23T13:24:30.000Z","updated_at":"2024-09-08T11:49:07.000Z","dependencies_parsed_at":"2024-06-23T17:24:24.026Z","dependency_job_id":"dbf224e8-b1ec-4fa2-a9e3-699585764618","html_url":"https://github.com/W-ptra/Spring_Boot_CRUD_API","commit_stats":null,"previous_names":["w-ptra/spring_boot_crud_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/W-ptra/Spring_Boot_CRUD_API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/W-ptra%2FSpring_Boot_CRUD_API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/W-ptra%2FSpring_Boot_CRUD_API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/W-ptra%2FSpring_Boot_CRUD_API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/W-ptra%2FSpring_Boot_CRUD_API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/W-ptra","download_url":"https://codeload.github.com/W-ptra/Spring_Boot_CRUD_API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/W-ptra%2FSpring_Boot_CRUD_API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32810382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"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":["java","jdbc-driver","spring-boot"],"created_at":"2024-11-25T04:09:03.719Z","updated_at":"2026-05-09T07:04:17.282Z","avatar_url":"https://github.com/W-ptra.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring_Boot_CRUD_API\nA simple RESTful API built with Spring Boot application that performs Create, Read, Update, and Delete (CRUD) operation on a \"Product\" table in MySQL database using JDBC Driver.\n## API Endpoint\n1. `GET http://localhost:8000/api/product`  \n\nRetrieve all product data from database   \n\nRespond:\n```\n[\n    {\n        \"id\": 1,\n        \"name\": \"Almond\",\n        \"price\": 24000\n    },\n    {\n        \"id\": 2,\n        \"name\": \"Chocolate\",\n        \"price\": 8000\n    }\n]\n```\n2. `GET http://localhost:8000/api/product/2`\n\nRetrieve a single product data identified by id 2\n\nRespond:\n```\n[\n    {\n        \"id\": 2,\n        \"name\": \"Chocolate\",\n        \"price\": 8000\n    }\n]\n```\n3. `POST http://localhost:8000/api/product`\n\nCreate a new product and store it on database\n\nRequest:\n```\n{\n    \"name\":\"Blueberry\",\n    \"price\":6000\n}\n```\nRespond:\n```\n{\n    \"message\": \"Product Created Sucessfully\"\n}\n```\n4. `PUT http://localhost:8000/api/product/2`\n\nMake a update to specified product that identified by id 2\n\nRequest:\n```\n{\n    \"name\":\"Gummy Bear\",\n    \"price\":11000\n}\n```\n\nRespond:\n```\n{\n    \"message\": \"Product Updated Sucessfully\"\n}\n```\n5. `DELETE http://localhost:8000/api/product/2`\n\nDelete a certain product on database identified by id 2\n\nRespond:\n```\n{\n    \"message\": \"Product Deleted Sucessfully\"\n}\n```\n## DOCKER USAGE\n1. Pull image\n```\ndocker pull wisnup001binus/spring-boot-crudapi:1.0\n```\n2. Run following command, change the environment variable `PORT`,`URL`,`USERNAME`,`PASSWORD`\n```\ndocker run -d \\\n    --name spring-boot-api \\\n    --network spring_network \\\n    -p 8080:3000 \\\n    -e PORT:{port} \\\n    -e URL={url} \\\n    -e USERNAME={username} \\\n    -e PASSWORD={password} \\\n    wisnup001binus/spring-boot-crudapi:1.0\n```\n### Quick Setup\n1. Run following script\n```\ndocker network create spring_network\n\ndocker run -d \\\n    --name mysql \\\n    --network spring_network \\\n    -p 7000:3306 \\\n    wisnup001binus/mysql_product_table:1.0\n    \ndocker network inspect spring_network\n```\n2. copy the ` \"IPv4Address\"` of `mysql`'s container, below is the example output  \n  \n![img](https://drive.google.com/uc?export=view\u0026id=16fi-0ccYZrKtXTZHLrF9zAXr6awsFpaD) \n3. Paste it on `URL=\"jdbc:mysql://172.21.0.2:3306/my_db\"` and run the script\n```\ndocker run -d \\\n    --name spring-boot-api \\\n    --network spring_network \\\n    -p 8080:3000 \\\n    -e PORT=3000 \\\n    -e URL=\"jdbc:mysql://172.21.0.2:3306/my_db\" \\\n    -e USERNAME=\"root\" \\\n    -e PASSWORD=\"root\" \\\n    wisnup001binus/spring-boot-crudapi:1.0\n```\n4. Open browser and paste following URL\n```\nhttp://localhost:8080/api/product\n```\nNote: Please wait around 2 - 3 minutes and refresh the page to see the product data  \n  \n5. Clean Up\n```\ndocker stop spring-boot-api mysql\ndocker remove spring-boot-api mysql\ndocker network remove spring_network\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw-ptra%2Fspring_boot_crud_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw-ptra%2Fspring_boot_crud_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw-ptra%2Fspring_boot_crud_api/lists"}