{"id":20321293,"url":"https://github.com/coder-eric/golang-gin-restfulapi-example-app","last_synced_at":"2025-04-11T19:05:15.136Z","repository":{"id":62291614,"uuid":"175765244","full_name":"coder-eric/golang-gin-restfulAPI-example-app","owner":"coder-eric","description":"An example Golang Restful API with [Gin, MongoDB, gin-jwt, gin-sessions, gin-authz, gin-swagger, validate.v9, casbin, go-ini]","archived":false,"fork":false,"pushed_at":"2019-03-16T01:54:17.000Z","size":165,"stargazers_count":130,"open_issues_count":2,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T14:51:18.803Z","etag":null,"topics":["casbin","gin","gin-authz","gin-jwt","gin-sessions","gin-swagger","go-ini","golang-gin-restfulapi","mongodb"],"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/coder-eric.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}},"created_at":"2019-03-15T06:52:29.000Z","updated_at":"2025-03-17T15:31:59.000Z","dependencies_parsed_at":"2022-10-30T04:31:13.110Z","dependency_job_id":null,"html_url":"https://github.com/coder-eric/golang-gin-restfulAPI-example-app","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/coder-eric%2Fgolang-gin-restfulAPI-example-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder-eric%2Fgolang-gin-restfulAPI-example-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder-eric%2Fgolang-gin-restfulAPI-example-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder-eric%2Fgolang-gin-restfulAPI-example-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coder-eric","download_url":"https://codeload.github.com/coder-eric/golang-gin-restfulAPI-example-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248465312,"owners_count":21108243,"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":["casbin","gin","gin-authz","gin-jwt","gin-sessions","gin-swagger","go-ini","golang-gin-restfulapi","mongodb"],"created_at":"2024-11-14T19:12:56.941Z","updated_at":"2025-04-11T19:05:15.054Z","avatar_url":"https://github.com/coder-eric.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# golang-gin-restfulAPI-example-app\n\n\n\n\u003e 一个用go语言基于Gin写的restful风格api服务程序的例子.\n\n## 项目特性\n- 基于[gin](https://github.com/gin-gonic/gin)\n- 使用[MongoDB](https://github.com/mongodb/mongo)数据库\n- [gin-jwt](https://github.com/appleboy/gin-jwt)权限验证\n- [gin-sessions](https://github.com/gin-contrib/sessions)\n- [gin-authz](https://github.com/gin-contrib/authz)从session里取用户的角色进行权限管理\n- 使用[gin-swagger](https://github.com/swaggo/gin-swagger)自动生成api文档\n- 将gin默认的validator.v8升级到[validator.v9](https://github.com/go-playground/validator)\n- 使用[casbin](https://github.com/casbin/casbin)权限管理\n- 使用[go-ini](https://github.com/go-ini/ini)读写配置文件\n\n## 项目目录\n```\n.\n├── server.go                       // 入口文件\n├── docs                            // swagger生成的api文档\n├── web                             // vue写的前端单页页面\n├── common\n│   ├── db                          // mongoDB相关\n│   ├── utils                       // 公用工具函数\n│   ├── pkg                         // 公用包\n|   |   └── e\n|   |       ├── code.go             // http状态码常量\n│   |       └── message.go          // 状态码对应的message常量\n│   ├── validator\n|   |   ├── custom_validate.go      // 自定义验证器\n│   |   └── v8_to_v9.go             // 将gin的默认验证器从v8升级到v9\n│   └── middlewares     \n|       ├── authz.go                // 角色认证\n│       └── session.go              // 使用session\n├── conf                            // 应用配置相关文件\n|   ├── authz                       \n|   |   ├── model.conf              // 权限管理方案配置\n│   |   └── policy.csv              // 权限分配表\n|   ├── app.ini                     // 应用配置文件\n│   └── conf.go                     // 初始化配置文件\n└── routers\n    ├── routers.go                  // 路由初始化\n    └── api                         // api文件\n        └── v1                      // api版本v1\n            ├── v1.go               // v1版本api入口\n            ├── mining-machine      // 矿机模块\n            |   ├── models.go       // 模型和数据库操作\n            |   ├── controlers.go   // 当前模块的控制器\n            |   ├── routers.go      // 当前模块的路由\n            |   ├── middlewares.go  // 当前模块的中间件\n            |   └── validators.go   // 当前模块的验证器\n            └── user                // 用户模块\n                ├── models.go       // 模型和数据库操作\n                ├── controlers.go   // 当前模块的控制器\n                ├── routers.go      // 当前模块的路由\n                ├── middlewares.go  // 当前模块的中间件\n                └── validators.go   // 当前模块的验证器\n    \n```\n\n## 联系作者\n\u003cimg src=\"qrcode.jpg\" width=\"300\" align=center alt=\"微信：wuhe52\"/\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder-eric%2Fgolang-gin-restfulapi-example-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoder-eric%2Fgolang-gin-restfulapi-example-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder-eric%2Fgolang-gin-restfulapi-example-app/lists"}