Resgate
A Go project implementing the RES protocol with NATS server as messaging system.
Used for building scaleable, resilient, extensible, and secure client API’s based on simple, stateless microservices serving live resources to web applications.
Resgate is the agnostic API gateway that makes it all possible, by handling things like subscriptions, resource caching, and access control.
Simple, stateless, and scalable like REST, but with live resources.
Quickstart
Assumed you’ve added $GOPATH/bin
to your PATH
environment variable already.
Install and run NATS server:
go get github.com/nats-io/gnatsd
gnatsd
Install and run Resgate:
go get github.com/jirenius/resgate
resgate
Download and run the Hello World example microservice in the language of your choice:
- Go microservice
- Node.js microservice (But why?)
Run the example client:
- Using Chrome - Go to this CodePen.
-
Using some other browser
Some browsers won’t allow accessing a non-encrypted websocket from an encrypted page.
Run the client javascript locally using a webpack server, or some other similar tool.
Web resource
For old REST based clients, resources can be retrieved using ordinary HTTP GET requests:
GET
http://localhost:8080/api/exampleService/myModel
Methods can be called using HTTP POST requests:
POST
http://localhost:8080/api/exampleService/myModel/set
Body
{ "message": "Updated through HTTP" }
Project page
More info and examples here:
Current state
We’ve joyfully used resgate successfully in a couple of projects. I really believe this project has a lot of potential!
Now it is time to put it under scrutiny, to see if it might solve or simplify creation of Push APIs for others as well.
Any feedback is highly appreciated!