Giter VIP home page Giter VIP logo

gin-web-template's Introduction

gin-web-template

gin 二次封装 web 框架. 项目分层设计, 便以开发 web 项目.

涉及 go 第三包

包名 描述
gin web 框架
viper 配置管理
gorm orm 框架
mysql 数据库
redis 缓存数据库
jwt 身份认证
zap 日志管理器

目录结构设计

项目部署目录(或者子目录)
├─cmd                   程序目录
│  └─main.go            应用主入口
│
├─configs               配置目录
│  ├─config.go          应用配置
│
├─initialize            应用初始化
│  ├─config.go          配置初始化
│  ├─database.go        数据库初始化
│  ├─logger.go          日志初始化
│  ├─router.go          路由初始化
│
├─internal              私有应用程序和库代码
│  │─app                应用   
│  │ ├─controller       控制器目录
│  │ ├─middleware       中间件目录
│  │ ├─models           模型目录
│  │ ├─router           路由目录
│  │ ├─service          服务层目录
│  │ ├─static           资源目录
│  │ ├─utils            应用核心目录
│
├─logs                  错误日志
├─go.mod                Go module相关
├─go.sum                Go module相关
├─LINCENSE              授权说明
├─README.md             README 文件
├─settings-dev.yaml     环境变量示例文件

使用说明

  • git clone 此项目, 修改 go.mod 的包名称改成你的
  • setting-dev.yaml 重命名为 setting.yaml
  • 路由定义统一在 internal/app/router/app.go 编写, 通过 utils.AddRoute 定义路由, 具体使用可看示例

参考

最后

欢迎提出 issue 和 pull request

License

MIT

gin-web-template's People

Contributors

uuk020 avatar

Stargazers

Luo Yao avatar  avatar

Watchers

James Cloos avatar  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.