Giter VIP home page Giter VIP logo

dogego's Introduction

DogeGoIcon

DogeGo

使用DogeGo开发分布式WebAPI: 用最简单的架构, 实现支持分布式的够用的框架, 服务大量的用户.

本框架是我从我编写的很多上生产的项目中拆分出来的(包括个人外包和学校项目), 所以性能是有保证的, 而且得益于Go的超高性能, 而且我的设计, 本身就是支持分布式的, 所以, 可以放心使用.

目的

本项目采用了一些Golang里面比较流行的我试用过的组件,让大家快速搭建支持分布式的Restful Web API.

特色

本项目整合了开发API的基础类库:

  1. Gin: 轻量级Web框架,自称路由速度是golang最快的
  2. GORM: ORM工具。本项目需要配合Mysql使用
  3. Gin-Session: Gin框架提供的Session操作工具
  4. Go-Redis: Golang Redis客户端
  5. godotenv: 开发环境下的环境变量工具,方便使用环境变量
  6. Gin-Cors: Gin框架提供的跨域中间件
  7. DogeGo Task 自行实现了分布式定时任务(已经废除)
  8. 本项目使用Redis分布式Session存储登录信息, 默认支持分布式, 无需更换
  9. 参考Celery实现了分布式定时任务和异步任务

本项目已经预先实现了一些常用的代码方便参考和复用:

  1. 创建了用户模型
  2. 实现了/api/v1/ping心跳检查接口
  3. 实现了/api/v1/user/register用户注册接口
  4. 实现了/api/v1/user/login用户登录接口
  5. 实现了/api/v1/user/me用户信息(需要登录后获取session)
  6. 实现了/api/v1/user/change_password用户密码修改接口(需要登录后获取session)
  7. 实现了/api/v1/user/update_profile用户Profile更新接口(需要登录后获取session)
  8. 实现了/api/v1/user/logout用户登出接口(需要登录后获取session)
  9. 实现了time定时任务, 可以直接使用,每小时运行一次,作为参考(废除).
  10. 实现了权限控制auth/role.go

本项目已经预先创建了一系列文件夹划分出下列模块:

  1. api文件夹就是MVC框架的controller,负责协调各部件完成任务
  2. models文件夹负责存储数据库模型和数据库操作相关的代码
  3. services负责处理比较复杂的业务,把业务代码模型化可以有效提高业务代码的质量(比如用户注册,充值,下单等)
  4. serializer储存通用的json模型,把models得到的数据库模型转换成api需要的json对象
  5. cache负责redis缓存相关的代码
  6. auth权限控制文件夹
  7. utils一些通用的小工具
  8. conf放一些静态存放的配置文件
  9. global放Redis全局计数器、排行榜之类的分布式共享资源
  10. modules放需要全局单例使用的模块, 类似于ASP.NetCore的IOC的单例模式
  11. routers放路由信息
  12. tasks放定时任务

赞助

赞助

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.