/go-nats-api-example

Example how to create API use Nats MQ.

Primary LanguageGoApache License 2.0Apache-2.0

Go Report Card GoDoc

Go Nats API Example

This example show how to use Nats to create API. Project use Go modules to download dependencies. You can see dependencies in go.mod

Docker

How to install:

  1. Install Docker-CE (ubuntu)
  2. Install Docker compose
  3. In project root: sudo docker-compose up

Settings file

API settings file use RFC7159

Example settings.json (all settings is required) :

{
  "name": "api",
  "version": "1.0.0",
  "nats": {
    "version" : "1.4.2",
    "reconnectedWait" : 5,
    "address" : [
      {
        "host" : "localhost",
        "port" : "54222"
      },
      {
        "host" : "localhost",
        "port" : "54222"
      }
    ]
  }
}