GithubHelp home page GithubHelp logo

gothinkster / golang-gin-realworld-example-app Goto Github PK

View Code? Open in Web Editor NEW
2.4K 50.0 483.0 197 KB

Exemplary real world application built with Golang + Gin

Home Page: https://realworld.io

License: MIT License

Go 98.92% Shell 1.08%
gin golang crud todolist todomvc gorm go gin-mvc example best-practices

golang-gin-realworld-example-app's Introduction

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.

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)

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.