Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gothinkster/golang-gin-realworld-example-app
Exemplary real world application built with Golang + Gin
https://github.com/gothinkster/golang-gin-realworld-example-app
api best best-practices boilerplate crud example gin gin-mvc go golang gorm jwt practice realworld rest restful sample starter todolist todomvc
Last synced: about 14 hours ago
JSON representation
Exemplary real world application built with Golang + Gin
- Host: GitHub
- URL: https://github.com/gothinkster/golang-gin-realworld-example-app
- Owner: gothinkster
- License: mit
- Created: 2017-10-02T18:30:41.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-05T04:06:57.000Z (11 months ago)
- Last Synced: 2024-11-20T19:40:20.704Z (23 days ago)
- Topics: api, best, best-practices, boilerplate, crud, example, gin, gin-mvc, go, golang, gorm, jwt, practice, realworld, rest, restful, sample, starter, todolist, todomvc
- Language: Go
- Homepage: https://realworld.io
- Size: 192 KB
- Stars: 2,524
- Watchers: 51
- Forks: 496
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - golang-gin-realworld-example-app
README
# ![RealWorld Example App](logo.png)
[![Build Status](https://travis-ci.org/wangzitian0/golang-gin-realworld-example-app.svg?branch=master)](https://travis-ci.org/wangzitian0/golang-gin-realworld-example-app)
[![codecov](https://codecov.io/gh/wangzitian0/golang-gin-realworld-example-app/branch/master/graph/badge.svg)](https://codecov.io/gh/wangzitian0/golang-gin-realworld-example-app)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/gothinkster/golang-gin-realworld-example-app?status.svg)](https://godoc.org/github.com/gothinkster/golang-gin-realworld-example-app)> ### 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.
# Directory structure
```
.
├── 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 Golang
Make sure you have Go 1.13 or higher installed.
https://golang.org/doc/install
## Environment Config
Set-up the standard Go environment variables according to latest guidance (see https://golang.org/doc/install#install).
## Install Dependencies
From the project root, run:
```
go build ./...
go test ./...
go mod tidy
```## Testing
From the project root, run:
```
go test ./...
```
or
```
go test ./... -cover
```
or
```
go test -v ./... -cover
```
depending on whether you want to see test coverage and how verbose the output you want.## 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)