Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ks-avinash/golang-gin-realworld-example-app
Exemplary real world application built with Golang + Gin
https://github.com/ks-avinash/golang-gin-realworld-example-app
Last synced: 3 months ago
JSON representation
Exemplary real world application built with Golang + Gin
- Host: GitHub
- URL: https://github.com/ks-avinash/golang-gin-realworld-example-app
- Owner: ks-avinash
- License: mit
- Fork: true (gothinkster/golang-gin-realworld-example-app)
- Created: 2021-02-19T15:57:17.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-14T07:57:18.000Z (over 4 years ago)
- Last Synced: 2023-09-12T17:31:56.869Z (over 1 year ago)
- Homepage: https://realworld.io
- Size: 172 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# ![RealWorld Example App](logo.png)
[![Build Status](https://travis-ci.org/wangzitian0/golang-gin-starter-kit.svg?branch=master)](https://travis-ci.org/wangzitian0/golang-gin-starter-kit)
[![codecov](https://codecov.io/gh/wangzitian0/golang-gin-starter-kit/branch/master/graph/badge.svg)](https://codecov.io/gh/wangzitian0/golang-gin-starter-kit)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/wangzitian0/golang-gin-starter-kit/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/wangzitian0/golang-gin-starter-kit?status.svg)](https://godoc.org/github.com/wangzitian0/golang-gin-starter-kit)> ### Golang/Gin codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/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 reloadhttps://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)