golang-gin-realworld-example-app

使用Golang + Gin构建的示例性真实世界应用程序。(Exemplary real world application built with Golang + Gin)

Github星跟蹤圖

RealWorld Example App

Build Status
codecov
License: MIT
GoDoc

Golang/Gin codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Golang/Gin including CRUD operations, authentication, routing, pagination, and more.

How it works

.
├── gorm.db
├── hello.go
├── common
│   ├── utils.go        //small tools function
│   └── database.go     //DB connect manager
└── users
    ├── models.go       //data models define & DB operation
    ├── serializers.go  //response computing & format
    ├── routers.go      //business logic & router binding
    ├── middlewares.go  //put the before & after logic of handle request
    └── validators.go   //form/json checker

Getting started

Install the Golang

https://golang.org/doc/install

Environment Config

make sure your ~/.*shrc have those varible:

➜  echo $GOPATH
/Users/zitwang/test/
➜  echo $GOROOT
/usr/local/go/
➜  echo $PATH
...:/usr/local/go/bin:/Users/zitwang/test//bin:/usr/local/go//bin

Install Govendor & Fresh

I used Govendor manage the package, and Fresh can help build without reload

https://github.com/kardianos/govendor

https://github.com/pilu/fresh

cd
go get -u github.com/kardianos/govendor
go get -u github.com/pilu/fresh
go get -u golang.org/x/crypto/...

Start

➜  govendor sync
➜  govendor add +external
➜  fresh

Testing

➜  go test -v ./... -cover

Todo

  • More elegance config
  • Test coverage (common & users 100%, article 0%)
  • ProtoBuf support
  • Code structure optimize (I think some place can use interface)
  • Continuous integration (done)

主要指標

概覽
名稱與所有者gothinkster/golang-gin-realworld-example-app
主編程語言Go
編程語言Go (語言數: 2)
平台BSD, Linux, Mac, Windows
許可證MIT License
所有者活动
創建於2017-10-02 18:30:41
推送於2024-01-05 04:06:57
最后一次提交2022-08-31 06:13:12
發布數5
最新版本名稱0.0.6 (發布於 )
第一版名稱0.0.1 (發布於 )
用户参与
星數2.6k
關注者數50
派生數505
提交數108
已啟用問題?
問題數18
打開的問題數2
拉請求數6
打開的拉請求數7
關閉的拉請求數4
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?