Giter Site home page Giter Site logo

dut3062796s / snake-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from go-eagle/eagle

0.0 1.0 0.0 423 KB

一款小巧的基于Go构建的API开发框架,可以快速进行业务开发,遵循SOLID原则

License: MIT License

Makefile 2.73% Shell 8.90% Go 87.58% TSQL 0.79%

snake-1's Introduction

snake

GitHub Workflow Status codecov GolangCI godoc Go Report Card License

一款适合于快速开发业务的Go框架,主要是提供API服务。

技术栈

  • 框架路由使用 gin 路由
  • 中间件使用 gin 框架的中间件
  • 数据库组件 gorm
  • 文档使用 swagger 生成
  • 配置文件解析库 viper
  • 使用 JWT 进行身份鉴权认证
  • 校验器 validator 也是 gin 框架默认的校验器,当前最新是v9版本
  • 任务调度 cron
  • 包管理工具 go module
  • 测试框架 goConvey
  • CI/CD Github Actions

特性

  • 遵循 RESTful API 设计规范
  • 基于 GIN WEB 框架,提供了丰富的中间件支持(用户认证、跨域、访问日志、请求频率限制、追踪 ID 等)
  • 基于 GORM 的数据库存储
  • JWT 认证
  • 支持 Swagger 文档(基于swaggo)
  • 使用 make 来管理Go工程
  • 使用 shell(admin.sh) 脚本来管理进程
  • 支持多环境配置

目录结构

├── Makefile                     # 项目管理文件
├── conf                         # 配置文件统一存放目录
├── config                       # 专门用来处理配置和配置文件的Go package                 
├── db.sql                       # 在部署新环境时,可以登录MySQL客户端,执行source db.sql创建数据库和表
├── docs                         # swagger文档,执行 swag init 生成的
├── handler                      # 类似MVC架构中的C,用来读取输入,并将处理流程转发给实际的处理函数,最后返回结果
├── log                          # 存放日志的目录
├── main.go                      # 项目入口文件
├── model                        # 数据库model
├── pkg                          # 一些封装好的package
├── repository                   # 数据访问层
├── router                       # 路由及中间件目录
├── service                      # 业务逻辑封装
├── schedule                     # 任务调度配置目录
└── scripts                      # 存放用于执行各种构建,安装,分析等操作的脚本

下载安装

# 进入到自己的开发目录,下载安装即可,可以不用是 GOPATH
git clone https://github.com/1024casts/snake

快速开始

// 下载依赖
make dep

// 编译项目
make build

// 本地环境
cp config.sample.yaml config.local.yaml

// 运行
./snake -c conf/config.local.yaml

常用命令

  • make help 查看帮助
  • make dep 下载go依赖包
  • make build 编译项目
  • make swag-init 生成接口文档(需要重新编译)
  • make test-coverage 生成测试覆盖
  • make lint 检查代码规范

模块

  • 用户(示例)

接口文档

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

开发规约

CHANGELOG

更新日志

谁在用

Discussion

License

MIT. See the LICENSE file for details.

snake-1's People

Contributors

qloog avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.