Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 23 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
##-----GET LIBRARIES----------------------##
## Run this command line
go get
# Example project using gRPC and http transcoding

## Install tools

Install dep tool: https://golang.github.io/dep/docs/installation.html
Install MongoDB and make sure it's running on localhost:27017

## Make sure all the dependencies is in sync

`dep status` && `dep ensure`

## Start Server

##-----RUN SERVER-------------------------##
## Run server gRPC
go run server/*.go
## Run server http
go run gateway/main.go

##-------Some example tests----------------##
## Example API Calls

## List entities

curl -X GET 'http://localhost:8080/entities'

## Create entity

curl -X POST 'http://localhost:8080/entities' \
-d '{"name":"Phuc qua dep trai","description":"Kha la banh","url":"phucdeptrai.com.vn"}'

## Read entity

curl -X GET "http://localhost:8080/entities/5d11e96b9dadaf6eef8599be"

## Update entity

curl -X PUT 'http://localhost:8080/entities' \
-d '{"id":"5d11e8ee9dadaf6eef8599b9","name":"Phuc qua dep trai","description":"Kha la banh","url":"phucdeptrai.com.vn"}'

## Delete entity

curl -X DELETE "http://localhost:8080/entities/5d11e8ee9dadaf6eef8599b9"

##-------USE KONG AS API GATEWAY--------------##
Expand Down
167 changes: 167 additions & 0 deletions gateway/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions gateway/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
branch = "master"
name = "github.com/golang/glog"

[[constraint]]
name = "github.com/grpc-ecosystem/grpc-gateway"
version = "1.9.2"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[[constraint]]
name = "google.golang.org/grpc"
version = "1.21.1"

[prune]
go-tests = true
unused-packages = true
2 changes: 1 addition & 1 deletion gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net/http"

pb "Example-CRUD-with-Mongo-use-http-transcoding-to-gRPC/server/entity"
pb "github.com/trinhdaiphuc/Example-CRUD-with-Mongo-use-http-transcoding-to-gRPC/server/entity"

"github.com/golang/glog"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand Down
Loading