{"id":19958027,"url":"https://github.com/monkrus/go-rest-api","last_synced_at":"2025-10-04T06:19:16.343Z","repository":{"id":98016507,"uuid":"249569782","full_name":"monkrus/go-rest-api","owner":"monkrus","description":"Simple server to handle HTTP requests","archived":false,"fork":false,"pushed_at":"2020-03-24T15:32:39.000Z","size":6244,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T14:39:01.602Z","etag":null,"topics":["api","golang","http-requests","restapi","server"],"latest_commit_sha":null,"homepage":"https://monkrus.github.io/go_rest_api/","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/monkrus.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":"2020-03-23T23:50:25.000Z","updated_at":"2024-06-19T07:49:43.639Z","dependencies_parsed_at":null,"dependency_job_id":"7f5a00c9-888e-4978-9dda-1e7fbf056211","html_url":"https://github.com/monkrus/go-rest-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/monkrus/go-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkrus%2Fgo-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkrus%2Fgo-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkrus%2Fgo-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkrus%2Fgo-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monkrus","download_url":"https://codeload.github.com/monkrus/go-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monkrus%2Fgo-rest-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278273794,"owners_count":25959801,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","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":["api","golang","http-requests","restapi","server"],"created_at":"2024-11-13T01:39:53.088Z","updated_at":"2025-10-04T06:19:16.303Z","avatar_url":"https://github.com/monkrus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://github.com/monkrus\"\u003e\u003cimg src=\"https://monosnap.com/image/nGg2FJacdl0L9qIgZSxBNtx3BibEBa\" title=\"GoLang champion\" alt=\"GoLang champion\"\u003e\u003c/a\u003e\n\n# REST API \nWe are creating a simple server to handle HTTP requests which helps us to provide communication between separate software components.\n\n## Getting Started\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to start the project on a live system.\n\n### Prerequisites\nWhat things you need to install the software and how to install them\n```\ninstall GoLang\n```\n\n### Features\n\u003e Three distinct functions:\n\n- HomePage function handles all requests to our root URL. \n- HandleRequests function  matches the URL path hit with a defined function. \n- Main function kicks off the API (entry point)\n\n## Running\n\n- We run `go run main.go` to test the basic functionality of those 3 functions. (Result: \"Homepage Endpoint Hit\" message )\n- Create an API that returns a JSON response \n- Define an Article struct, set an Article array\n- Register our function\n\n# Example\n- `$ go run main.go`  \n- Return a JSON response under `http://localhost:8000/articles`. Success !\n\u003cimg src=\"https://monosnap.com/image/j2YVHoLcSMRNLpejkWfcvJ88qQ4za9\"\u003e\n\n# Example (Optional)\n![Refactor](recordgif.gif)\n- Introducing gorilla/mux\n- Add lines to handleRequests func\n- Test Gorilla/mux,`$ go run main.go`\n```go \n myRouter.HandleFunc(\"/articles\", allArticles).Methods(\"GET\")\n myRouter.HandleFunc(\"/articles\", testPostArticles).Methods(\"POST\")\n``` \n- Run `$ go run main.go` and compare following lines in Postman\n \n \u003cimg src=\"https://monosnap.com/image/AZya89egN8yFXxsmI31oAYF8VPbICL\"\u003e\n \n\n \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkrus%2Fgo-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonkrus%2Fgo-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonkrus%2Fgo-rest-api/lists"}