All Projects → will110 → ginhelper

will110 / ginhelper

Licence: other
gin framework helper

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to ginhelper

httpsign
Signing HTTP Messages Middleware
Stars: ✭ 54 (+237.5%)
Mutual labels:  gin, gin-middleware, gin-gonic
requestid
Request ID middleware for Gin Framework
Stars: ✭ 115 (+618.75%)
Mutual labels:  gin, gin-middleware, gin-gonic
go-gin-logrus
Gin Web Framework for using Logrus as the Gin logger with Tracing middleware
Stars: ✭ 38 (+137.5%)
Mutual labels:  gin, gin-middleware, gin-gonic
logger
Gin middleware/handler to logger url path using rs/zerolog
Stars: ✭ 119 (+643.75%)
Mutual labels:  gin, gin-gonic
souin
An HTTP cache system, RFC compliant, compatible with @TykTechnologies, @traefik, @caddyserver, @go-chi, @bnkamalesh, @beego, @devfeel, @labstack, @gofiber, @go-goyave, @gin-gonic, @zalando, @zeromicro, @nginx and @apache
Stars: ✭ 269 (+1581.25%)
Mutual labels:  gin-middleware, gin-gonic
pink-lady
a template project of gin app.
Stars: ✭ 44 (+175%)
Mutual labels:  gin, gin-framework
logging
mod: zap logging in golang
Stars: ✭ 44 (+175%)
Mutual labels:  gin, gin-middleware
go-12factor-example
Example the 12factor app using golang
Stars: ✭ 20 (+25%)
Mutual labels:  gin, gin-gonic
website
Official website and document for Gin
Stars: ✭ 88 (+450%)
Mutual labels:  gin, gin-gonic
gin-rest-api
Example golang using gin framework everything you need, i create this tutorial special for beginner.
Stars: ✭ 56 (+250%)
Mutual labels:  gin, gin-gonic
gin-swagger
DRY templates for go-swagger
Stars: ✭ 79 (+393.75%)
Mutual labels:  gin, gin-gonic
Gin Swagger
gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
Stars: ✭ 2,001 (+12406.25%)
Mutual labels:  gin, gin-middleware
geo-smart-system
Open Source Realtime Tracking System
Stars: ✭ 36 (+125%)
Mutual labels:  gin, gin-gonic
go-gin-web-server
Deploy Go Gin on Render
Stars: ✭ 23 (+43.75%)
Mutual labels:  gin, gin-gonic
go api boilerplate
🐶Go (Golang)🚀REST / GraphQL API + Postgres boilerplate
Stars: ✭ 127 (+693.75%)
Mutual labels:  gin, gin-gonic
Goweibo
Go Weibo App
Stars: ✭ 243 (+1418.75%)
Mutual labels:  gin
gonrails
Rails like mvc backend application with golang .
Stars: ✭ 37 (+131.25%)
Mutual labels:  gin
Awesome Gin
awesome for gin framework
Stars: ✭ 236 (+1375%)
Mutual labels:  gin
Nlpgnn
1. Use BERT, ALBERT and GPT2 as tensorflow2.0's layer. 2. Implement GCN, GAN, GIN and GraphSAGE based on message passing.
Stars: ✭ 221 (+1281.25%)
Mutual labels:  gin
gin-cache
🚀 A high performance gin middleware to cache http response. Compared to gin-contrib/cache, It has a huge performance improvement. 高性能gin缓存中间件,相比于官方版本,有巨大性能提升。
Stars: ✭ 151 (+843.75%)
Mutual labels:  gin

ginhelper

ginhelper 是一个gin web框架的快速搭建项目的助手,帮助你快速开发项目、简单、易用。

一、使用方法

1、下载

go get -u github.com/will110/ginhelper

2、生成项目

(1)、如果你使用go mod管理项目,操作如下,这里以windows为例,其他系统操作一样,这里的操作都在d:/goMod/test目录下进行。

1、生成 go.mod文件

    set GO111MODULE=on
    go mod init hello


2、生成项目

    ginhelper create


3、更新依赖包

    go mod tidy


4、编译

    go build


5、运行

    ./hello
    
    
6、测试

    curl http://127.0.0.1:8099/user/get-list-query?user=a3c&password=23
    或者直接在浏览器上访问,返回内容如下
    {
      "run_time": 0,
      "code": -110020,
      "message": "Key: 'Login.User' Error:Field validation for 'User' failed on the 'eq' tag",
      "data": ""
    }


7、review code

    你可以通过某个开发工具,如:goland, 来打开你的项目,然后慢慢、静静的看一下代码

(2)、如果你只是在src目录下开发项目,你可以这样操作,这里以windows为例,其他系统操作一样,这里的操作都在d:/goProject/src/hiworld目录下进行。

1、创建项目

    ginhelper create
   
2、下载其他的依赖

   go get -u github.com/gin-gonic/gin
   go get github.com/astaxie/beego/config  #这里我们可以使用beego的config, 如果你还想使用beego的其他模块请自行下载,如:httplib、logs、cache等模块
   go get github.com/beego/bee  #可选下载
   github.com/jinzhu/gorm
   github.com/go-redis/redis
   
   
3、编译

   go build 或者bee run
   
   
4、运行

   ./hiworld
   
   
5、测试
   
   curl http://127.0.0.1:8099/user/get-list-query?user=a3c&password=23
   或者直接在浏览器上访问,返回内容如下
   {
     "run_time": 0,
     "code": -110020,
     "message": "Key: 'Login.User' Error:Field validation for 'User' failed on the 'eq' tag",
     "data": ""
   }

目录介绍

command  
    脚本目录,这个目录下可以存放一些脚本的业务逻辑,你根据自己业务的不同,然后创建自己的目录
    
conf
    配置文件目录,这个目录下存放了各个环境的配置文件,然后我们只需要在环境变量中配置WebRunMode对应的值即可.
    比如: WebRunMode=test, 那么使用的配置文件就是test_app.conf, 而local_app.conf是本地配置文件优先级高于
    任何配置文件,如果你在test_app.conf中设置name = "hi", 然后在local_app.conf中设置name = "hello", 那么最终
    name的值是hello。
    
controller
    控制器目录,这里是接口地址的入口点

filter
    数据过滤层, 对每个接口请求过来的数据,进行严格的清洗,然后组装相应的数据,以便后面的程序使用

model
    model层,可以存放一些关于表对应的结构体、字段或者简单操作表数据的方法

pkg
    pkg存放自己封装的公共方法或公共变量、常量等
    
router
    接口地址的路由配置
    
runtime
    存放运行时的一些缓存文件、日志等
    
servicelogic
    业务逻辑层,可以把大量的业务逻辑写在这里
    
static
    静态目录,可以存放图片、文件等
    
test
    接口测试目录

当然了大家也可以根据自己的喜好设计自己喜欢的目录结构,项目框架整合了mysql、redis、mongodb等相关配置, 默认代码是注释的,你需要把mysql、redis、mongodb的配置文件进行配置,然后打开注释,试着运行一下。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].