REST Gateway
REST API Gateway service, generated from the Swagger doc found in the root ./swagger.yml
.
The swagger doc generates Go code. We're using https://github.com/go-swagger/go-swagger
.
Each REST endpoint calls another service internally. These are mostly gRPC calls, but there are some REST call as well.
Updating the Swagger doc
$ swagger generate server -A MediaMagic -f ./swagger.yml
New endpoints added, need to be added in ./restapi/configure_media_magic.go
. There you need to add the code that backs up each endpoint. For example calling the right internal service, mapping the data to match the generated schema.
Running this service
Docker
$ docker build -t rest-gateway .
$ docker run -p 8080:8080 -e PORT=8080 rest-gateway
Go
$ PORT=8080 go run ./cmd/media-magic-server/main.go
For local testing (no https)
$ go run cmd/media-magic-server/main.go --scheme http
Last updated