May CMF Serverless CMF writen on GO
RBAC scaffolding based on Gin + GORM + Casbin + Dig. The goal is to provide a lightweight front-end and back-end development framework to facilitate the rapid development of business requirements.
- Following the RESTful API design specification
- Casbin based RBAC access control model
- Based on the GIN WEB framework, it provides rich middleware support (user authentication, cross-domain, access logs, request frequency limit, tracking ID, etc.)
- JWT authenticate (Blacklist-based authentication mode, storage support: file/redis)
- Database storage based on GORM (the storage layer uses external interfaces for the business layer to invoke, which completely isolates the storage layer)
- Dependency injection - based on dig
- Log tracking - based on logrus, log hook support GORM.
- Swagger documentation - based on swaggo
- Unit testing - based on
net/http/httptest
package, covering all interface layer tests.
Use mash tool for quick clean installation and generate addons.
$ go get -u github.com/MayCMF/core
$ cd ~/go/src/github.com/MayCMF/core
$ go run cmd/server.go
After the startup is successful, you can enter the address access in the browser: http://localhost:8088/swagger/
$ git clone git@github.com:MayCMF/core.git
$ cd ~/path/to/cloned/directory
$ go mod vendor
$ go run cmd/server.go
After a successful start, you can enter the address in the browser to access: http://localhost:8088/swagger/
- The default configuration uses the sqlite3 database, and the database file (
automatically generated
) is indata/MayCMF.db
. If you want switch tomysql
orpostgres
, change the configuration file. - The default configuration of the log is standard output. If you want to switch to write to a file or write to gorm storage, you need change configurations by yourself:
configs/config.toml
.
Comming soon ....
For document rules, please refer to: https://github.com/swaggo/swag#declarative-comments-format
$ go get -u -v github.com/swaggo/swag/cmd/swag
$ swag init -g ./src/[COMPONENT]/routers/swagger.go -o ./docs/swagger
Once the document is generated, you can enter the address in your browser:http://localhost:8088/swagger/