GithubHelp home page GithubHelp logo

leezhonglin / go-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyj19/go-web

0.0 0.0 0.0 440 KB

go-web是使用gin+gorm+casbin+mysql+redis的基于rbac模型的权限管理系统。主要目的是使初学者通过项目进一步掌握go;其次也可以作为一个基本的后台管理系统脚手架来进行二次开发。

License: MIT License

Go 100.00%

go-web's Introduction

Go Web

由gin + jwt + casbin + gorm技术栈实现Golang版的RBAC权限管理脚手架, 其主要目的是使Golang初学者通过实践进一步掌握Golang相关的开发技能

Go version Gin version Gorm version License

特性

  • RESTful API 设计风格
  • MySQL 数据库存储
  • gin golang web 的微框架
  • gorm 数据库的ORM管理框架
  • gin-jwt gin封装的jwt中间件,用户认证
  • casbin 轻量级开源访问控制框架,RBAC
  • go-redis redis客户端开发工具
  • viper 轻便的golang配置管理工具
  • zap 高性能日志库,提供多种级别的日志打印
  • lumberjack 日志文件切割归档工具

项目结构

├── cmd
│    └── admin # admin项目主程序入口
├── configs # 配置目录
├── internal # 内部目录,不对外公开
│    ├── admin # admin项目目录
│    │     ├── api # api目录
│    │     │    └── v1 # v1版本接口目录(类似于Java中的controller), 如果有新版本可以继续添加v2/v3
│    │     ├── global # 全局公用模型目录
│    │     ├── router # 路由目录
│    │     ├── service # 业务逻辑目录
│    │     │    └── v1 # v1版本业务目录, 如果有新版本可以继续添加v2/v3
│    │     ├── store # 数据操作目录
│    │     ├── data.go # 初始化数据
│    │     └── router.go # 定义路由规则
│    ├── pkg # 内部公共模块目录
│    │     ├── cache # redis操作目录
│    │     ├── cofnig # 配置实体目录
│    │     ├── db # 数据库目录
│    │     ├── initialize # 工具初始化目录
│    │     ├── logger # 日志目录
│    │     ├── middleware # 中间件目录
│    │     ├── model # 传输模型目录
│    │     ├── response # 响应模型目录
│    │     └── util # 工具包目录
├── logs # 日志文件目录
├── pkg # 外部公共模块目录
├── .gitignore # git忽略
├── go.mod # go依赖列表
├── go.sum # go依赖下载历史
├── LICENSE # 开源证书
├── README.md # 说明文档

快速开始

# 开始前请使用go mod,它可以为你减少很多麻烦

# 下载项目
git clone https://github.com/cyj19/go-web.git

# 进入admin主程序入口
cd cmd/admin

# 运行程序
# 使用开发环境默认配置运行
go run main.go 
# 使用生产环境指定配置运行
go run main.go -web_config=xxxx -web_mode=prod

启动成功后,携带参数username:admin password:123456,发送POST请求到 http://127.0.0.1:9999/api/v1/base/login 获取token

感想

花足够多的时间,做足够多的练习。
学习过程中一直深受如何快速高效率地学习Go语言文章影响,在此与大家分享。

特别鸣谢

本项目开发过程学习了以下大神的思路和代码风格,感谢大神!!!


[gin-vue-admin](https://github.com/flipped-aurora/gin-vue-admin): Gin-vue-admin is a full-stack (frontend and backend separation) framework designed for management system.
[gin-web](https://github.com/piupuer/gin-web)
[iam](https://github.com/marmotedu/iam)

MIT License

Copyright (c) 2021 cyj19

go-web's People

Contributors

cyj19 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.