{"id":15854092,"url":"https://github.com/jakecoffman/go-mongo-rest","last_synced_at":"2026-05-11T05:45:54.194Z","repository":{"id":147817122,"uuid":"429880858","full_name":"jakecoffman/go-mongo-rest","owner":"jakecoffman","description":"Example of a REST server with Go and Mongo","archived":false,"fork":false,"pushed_at":"2021-12-03T14:43:43.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T12:28:17.242Z","etag":null,"topics":["gin-gonic","go","mongodb","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/jakecoffman.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":"2021-11-19T17:25:11.000Z","updated_at":"2021-12-03T14:43:45.000Z","dependencies_parsed_at":"2023-04-25T19:30:50.547Z","dependency_job_id":null,"html_url":"https://github.com/jakecoffman/go-mongo-rest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecoffman%2Fgo-mongo-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecoffman%2Fgo-mongo-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecoffman%2Fgo-mongo-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecoffman%2Fgo-mongo-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakecoffman","download_url":"https://codeload.github.com/jakecoffman/go-mongo-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246695716,"owners_count":20819324,"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","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":["gin-gonic","go","mongodb","rest-api"],"created_at":"2024-10-05T19:40:48.280Z","updated_at":"2026-05-11T05:45:54.133Z","avatar_url":"https://github.com/jakecoffman.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-mongo-rest\n\nExample of how to make REST endpoints with Go and Mongodb.\n\n## How to run\n\nCopy/paste this into your terminal:\n\n```sh\ngit clone git@github.com:jakecoffman/go-mongo-rest.git\ncd go-mongo-rest\ngo run cmd/server/server.go\n```\n\n## Dependencies\n\n- [gin](https://github.com/gin-gonic/gin)\n  - This is a good router that has been around for a while. Feel free to pick your own. The builtin http.ServeMux doesn't support path variables and method routing so doing a deep path with many variables (/authors/{authorId}/books/{bookId}) is unruly.\n- [crud](https://github.com/jakecoffman/crud)\n  - Provides an easy way to get OpenAPI docs and validation middleware.\n- [mongo-driver](https://github.com/mongodb/mongo-go-driver)\n  - Official Go Mongodb driver.\n\n# Project layout\n\n- cmd\n  - Typical pattern in Go to store the main packages\n- lib\n  - It's common to separate the rest of the code into another package. I use lib, you can use pkg, it doesn't matter.\n- lib/db\n  - The mongo.Client and collections are exported from this package since they are thread safe. Makes things easier to manage than passing it down through Request Contexts.\n- lib/endpoonts\n  - All of our handlers and route definitions under this directory.\n- lib/models\n  - Models live in the same package since they often depend on each other, but we've separated concerns from the handlers. \n\n## TODO\n\n- With generics around the corner, we can remove all the boilerplate in author_handlers.go\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakecoffman%2Fgo-mongo-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakecoffman%2Fgo-mongo-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakecoffman%2Fgo-mongo-rest/lists"}