snake

A Go framework suitable for rapid business development, mainly to provide API services.

Technology stack

  • Gin routing is used for frame routing
  • Middleware Middleware that uses gin framework
  • Database component GORM
  • Documents are generated using Swagger
  • Configuration file parsing library Viper
  • JWT is used for identity authentication
  • Validator Validator is also the default validator for the GIN framework and is currently available in v9
  • Task scheduling cron
  • Package management tool Go Module
  • Test the framework goConvey
  • CI/CD Github Actions

features

  • Comply with RESTful API design specifications
  • Rich middleware support (user authentication, cross-domain, access logging, request frequency limiting, trace ID, etc.) based on GIN WEB framework
  • Gorm-based database storage
  • JWT certification
  • Support for Swagger documents (based on Swaggo)
  • Use make to manage the Go project
  • Use shell(admin.sh) scripts to manage processes
  • Supports multiple environment configurations

The directory structure

├─ └ ─ config # Go Package ├─ db.sql ├─ Makefile # ├─ config # Go Package ├─ db.sql ├─ docs # ├─ handler # Like C in MVC framework for reading input and forwarding the process to the actual processing function ├─ Log # ├─ Main.go # ├─ Model # Database Model ├─ PKG # Package ├─ Repository # Data Access Layer ├─ ├─ exercises, ├─ exercises, exercises, exercises, exercises, exercises, exercises, exercises, exercisesCopy the code

Download and install

# Go to your own development directory, download and install, you can not use GOPATH
git clone https://github.com/1024casts/snake
Copy the code

Quick start

Yaml config.local.yaml // Run./snake -c conf/config.local.yamlCopy the code

Common commands

  • Make help View the help information
  • Make dep Download the go dependency package
  • Make build Builds the project
  • Make swag-init to generate interface document
  • Make test-coverage Generates test coverage
  • Make Lint checks code specifications

The module

  • User (example)

Interface documentation

http://localhost:8080/swagger/index.html

Develop specifications

  • Configuration instructions
  • Error code design
  • Service usage rules
  • Rules for using repository
  • Cache Usage Instructions

CHANGELOG

Update log

Who is in use

  • 1024 class

Discussion

  • Issue: github.com/1024casts/s…

License

MIT. See the LICENSE file for details.