Giter Club home page Giter Club logo

golang-grpc-realworld-example's Introduction

realworld-logo

Test Status License: MIT GoDoc

Go/GRPC codebase containing RealWorld 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/grpc including CRUD operations, authentication, routing, pagination, and more.

How it works

figure

  • Using grpc-gateway as reverse-proxy server which translates a RESTful JSON API into gRPC.

  • Using Go to implement realworld backend server.

  • Using MySQL to store data.

Getting started

The app listens and serves on 0.0.0.0:3000.

  • docker-compose

    $ docker-compose up -d
    
  • local

    • Install Go 1.19+, MySQL
    • set environment variables to connect database like this.
    $ go run server.go # run grpc server
    $ go run gateway/gateway.go # run grpc-gateway server
    

Unit test

  • docker-compose

    $ docker-compose run app make unittest
    
  • local

    $ make unittest
    

E2E test

$ make e2etest

TODOs

  • Users and Authentication

    • POST /user/login: Existing user login
    • POST /users: Register a new user
    • GET /user: Get current user
    • PUT /user: Update current user
  • Profiles

    • GET /profiles/{username}: Get a profile
    • POST /profiles/{username}/follow: Follow a user
    • DELETE /profiles/{username}/follow: Unfollow a user
  • Articles

    • GET /articles/feed: Get recent articles from users you follow
    • GET /articles: Get recent articles globally
    • POST /articles : Create an article
    • GET /articles/{slug}: Get an article
    • PUT /articles/{slug}: Update an article
    • DELETE /articles/{slug}: Delete an article
  • Comments

    • GET /articles/{slug}/comments: Get comments for an article
    • POST /articles/{slug}/comments: Create a comment for an article
    • DELETE /articles/{slug}/comments/{id}: Delete a comment for an article
  • Favorites

    • POST /articles/{slug}/favorite: Favorite an article
    • DELETE /articles/{slug}/favorite: Unfavorite an article
  • Deafult

  • GET /tags: Get tags

  • E2E test

    ┌─────────────────────────┬───────────────────┬───────────────────┐
    │                         │          executed │            failed │
    ├─────────────────────────┼───────────────────┼───────────────────┤
    │              iterations │                 1 │                 0 │
    ├─────────────────────────┼───────────────────┼───────────────────┤
    │                requests │                31 │                 0 │
    ├─────────────────────────┼───────────────────┼───────────────────┤
    │            test-scripts │                46 │                 0 │
    ├─────────────────────────┼───────────────────┼───────────────────┤
    │      prerequest-scripts │                17 │                 0 │
    ├─────────────────────────┼───────────────────┼───────────────────┤
    │              assertions │               345 │                 0 │
    ├─────────────────────────┴───────────────────┴───────────────────┤
    │ total run duration: 17.5s                                       │
    ├─────────────────────────────────────────────────────────────────┤
    │ total data received: 8.73KB (approx)                            │
    ├─────────────────────────────────────────────────────────────────┤
    │ average response time: 33ms [min: 10ms, max: 150ms, s.d.: 31ms] │
    └─────────────────────────────────────────────────────────────────┘
    

golang-grpc-realworld-example's People

Contributors

raahii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

golang-grpc-realworld-example's Issues

リファクタリングの機運(モデル周り)

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.