Microservice gateway
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor/github.com/gomatic
.gitignore
.gitmodules
.travis.yml
Dockerfile
LICENSE
Makefile
README.md
handlers.go
jwt.go
main.go
mock.go
mw_caching.go
mw_headered.go
run.go
test.mk
v1.go

README.md

service gateway

reportcard build godoc License: GPL v3

Install

go get github.com/gomatic/gateway

Test

Install the example service

go get github.com/gomatic/service-example

Run the gateway

EXAMPLE_SERVICE_PORT=5000 gateway --debug >gateway.log 2>&1 & gateway_pid=$!

Test the gateway

curl -s localhost:3000/health         # The health check

debug routes

curl -s localhost:2999/header         # This debug route generates a JWT token
curl -s localhost:2999/debug/vars     # This debug route provides runtime information

Run the example service

API_PORT=5000 service-example --debug >service-example.log 2>&1 & service_pid=$!

Test the example service

curl -s localhost:5000/health         # The health check
curl -s localhost:5000/api/model.json # The OpenAPI documentation

debug routes

curl -s localhost:4999/debug/vars     # This debug route provides runtime information

Call the example service through the gateway

curl -is -H "$(curl -s localhost:2999/header)" http://localhost:3000/v1/example/health
curl -is -H "$(curl -s localhost:2999/header)" http://localhost:3000/v1/example/api/model.json

RPC

Install the example RPC client

go get github.com/gomatic/service-example/cmd/service-example-client

Call the example service through the RPC using the client helper

API_PORT=5000 service-example-client this is a great example message

Cleanup

kill ${gateway_pid} ${service_pid}
rm gateway.log service-example.log