Git Product home page Git Product logo

go-api-protocols's Introduction

go-api-protocols

Table of Contents

專案描述

  1. REST 實作
  2. GraphQL 實作
  3. Json-RPC 實作
  4. g-RPC 實作

執行專案

執行應用程式

#到專案目錄下
$ cd path_to_dir/go-api-protocols

# 下載第三方套件
$ go mod download

# 生成swagger文檔
$ swag init 

# 編譯專案(輸出到當前目錄下,檔案名為main)
$ go build -o main . 

# 執行應用程式
$ ./main 

REST API文檔(swagger)

#網址打入(default host=>localhost:8080)
http://{host}/swagger/index.html

GraphQL API文檔

#網址打入(default host=>localhost:8081)
http://{host}/graphql

g-RPC API文檔

需要先安裝grpcui

grpcui -plaintext {host}

修改專案

修改rest

#refresh swagger doc
swag init

修改graphQL

#refresh schema
go run github.com/99designs/gqlgen generate 

修改protocol buffer

需要先安裝proto compiler

#refresh protocol buffer
protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative protos/*.proto 

go-api-protocols's People

Contributors

daiwanwei avatar

Watchers

 avatar

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.