An open API service indexing awesome lists of open source software.

https://github.com/chase-allen-tech/protocol-rest-go

Protocol of REST Apis in GO
https://github.com/chase-allen-tech/protocol-rest-go

Last synced: about 1 month ago
JSON representation

Protocol of REST Apis in GO

Awesome Lists containing this project

README

        

# Golang Gin REST APIs

> An example of a restful style api service program written in go language based on Gin.

## Project features
- Based on [gin](https://github.com/gin-gonic/gin)
- Use [MongoDB](https://github.com/mongodb/mongo) database
- [gin-jwt](https://github.com/appleboy/gin-jwt) permission verification
- [gin-sessions](https://github.com/gin-contrib/sessions)
- [gin-authz](https://github.com/gin-contrib/authz) Get the user's role from the session for permission management
- Use [gin-swagger](https://github.com/swaggo/gin-swagger) to automatically generate api documentation
- Upgrade gin's default validator.v8 to [validator.v9](https://github.com/go-playground/validator)
- Use [casbin](https://github.com/casbin/casbin) permission management
- Use [go-ini](https://github.com/go-ini/ini) to read and write configuration files

## project directory
````
.
├── server.go // entry file
├── docs // api documentation generated by swagger
├── web // Front-end single-page page written by vue
├── common
│ ├── db // mongoDB related
│ ├── utils // Utility function
│ ├── pkg // public package
| | └── e
| | ├── code.go // http status code constant
│ | └── message.go // message constant corresponding to status code
│ ├── validator
| | ├── custom_validate.go // custom validator
│ | └── v8_to_v9.go // Upgrade gin's default validator from v8 to v9
│ └── middlewares
| ├── authz.go // role authentication
│ └── session.go // use session
├── conf // Application configuration related files
| ├── authz
| | ├── model.conf // Rights management scheme configuration
│ | └── policy.csv // permission assignment table
| ├── app.ini // application configuration file
│ └── conf.go // Initialize the configuration file
└── routers
├── routers.go // route initialization
└── api // api file
└── v1 // api version v1
├── v1.go // v1 version api entry
├── mining-machine // mining machine module
| ├── models.go // model and database operations
| ├── controllers.go // controllers for the current module
| ├── routers.go // routes for the current module
| ├── middlewares.go // middleware for the current module
| └── validators.go // validators for the current module
└── user // user module
├── models.go // model and database operations
├── controllers.go // controllers for the current module
├── routers.go // routes for the current module
├── middlewares.go // middleware for the current module
└── validators.go // validators for the current module

````