{"id":27153436,"url":"https://github.com/tankengine-ish/golang_restful_api","last_synced_at":"2026-05-09T06:07:39.924Z","repository":{"id":228850925,"uuid":"775091394","full_name":"TankEngine-ish/golang_restful_api","owner":"TankEngine-ish","description":"RESTful API hooked wtih a MySQL Database [personal project]","archived":false,"fork":false,"pushed_at":"2024-03-28T11:00:24.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-14T14:31:40.936Z","etag":null,"topics":["github-actions","mux-router","mysql","restful-api","wsl-ubuntu"],"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/TankEngine-ish.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-03-20T18:38:51.000Z","updated_at":"2024-04-24T13:02:46.000Z","dependencies_parsed_at":"2025-07-01T03:35:12.587Z","dependency_job_id":"218291b6-48dc-4910-8a42-06d50a92af24","html_url":"https://github.com/TankEngine-ish/golang_restful_api","commit_stats":null,"previous_names":["tankengine-ish/golang_restful_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TankEngine-ish/golang_restful_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankEngine-ish%2Fgolang_restful_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankEngine-ish%2Fgolang_restful_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankEngine-ish%2Fgolang_restful_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankEngine-ish%2Fgolang_restful_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TankEngine-ish","download_url":"https://codeload.github.com/TankEngine-ish/golang_restful_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankEngine-ish%2Fgolang_restful_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809149,"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":["github-actions","mux-router","mysql","restful-api","wsl-ubuntu"],"created_at":"2025-04-08T16:16:57.987Z","updated_at":"2026-05-09T06:07:39.898Z","avatar_url":"https://github.com/TankEngine-ish.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang_RESTful_API\n\nThis was my first API in Golang and it's a simple RESTful API for managing an inventory of products. It also uses MySQL for data storage.\n\n## Project Structure\nThe project is divided into several files:\n\n``app.go``: This file contains the main application logic. It sets up the HTTP server, connects to the database, and defines the routes for the API.\n\n``app_test.go``: This file contains unit tests for the application. It tests the API endpoints and database operations.\n\n``model.go``: This file defines the ``product`` struct and the methods for performing CRUD operations on the products in the database.\n\n``main.go``: This is the entry point of the application. It initializes and runs the app.\n\n``constants.go``: This file contains the constants for the database name, user, and password.\n\n## API Endpoints\nThe API provides the following endpoints:\n\n``GET /products``: Fetch all products.\n\n``GET /product/{id}``: Fetch a single product by its ID.\n\n``POST /product``: Create a new product.\n\n``PUT /product/{id}``: Update an existing product by its ID.\n\n``DELETE /product/{id}``: Delete a product by its ID.\n\n\n## Running the Tests\nTo run the tests, use the ``go test`` command in the root directory of the project.\n\n## Running the Application\nTo run the application, use the ``go run main.go`` command in the root directory of the project. The application will start a server on port 10000.\n\n## Database Configuration\nThe application connects to a MySQL database. The database name, user, and password are defined in the ``constants.go`` file. You can change these values to match your own database configuration.\n\n## Dependencies\nThis project uses the following Go packages:\n\n``database/sql``: For interacting with the database.\n\n``github.com/go-sql-driver/mysql``: The MySQL driver for Go's database/sql package.\n\n``github.com/gorilla/mux``: A powerful HTTP router and URL matcher for building Go web servers.\n\n``net/http``: For building HTTP servers and clients.\n\n``encoding/json``: For encoding and decoding JSON.\n\n\n## Deployment\nThe API was later deployed via GitHub Actions.\n\n## Notes\n\n* I can say that it's kinda nice not having to install a ton of third party packages and dependencies just to create a simple API like in Javascript. This is my fourth API project by now.\n\n* The content of constants.go file is just placeholder information. Of course I'm not going to upload sensitive credentials to github...\n\n* Once again I successfully deployed another project via github actions.\n\n![alt text](\u003cmedia/screengrab of pipeline.png\u003e)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftankengine-ish%2Fgolang_restful_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftankengine-ish%2Fgolang_restful_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftankengine-ish%2Fgolang_restful_api/lists"}