Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-eureka-client

go-eureka-client

Eureka client for Go projects for fetching all registered application in Eureka or fetching any available instance IP by application's name.

How to use

Import the package

     go get github.com/oneils/go-eureka-client

Create Eureka client by specifying http client and Eureka server's URL.

   client := http.Client{Timeout: 1 * time.Second}
    c := eureka.NewClient(&client, eurekaServer.URL+"/eureka/apps")

Import the package

    import (
		"github.com/oneils/go-eureka-client/pkg/eureka"
)

Fetch all Eureka applications

   apps, err := c.FetchAll()
   if err != nil {
       log.Fatal(err)
   }
   for _, app := range apps {
       fmt.Println(app.Name)
   }

Fetch Application IP by Application name

   app, err := c.FetchIPAddress("my-app")
   if err != nil {
       log.Fatal(err)
   }
   fmt.Println(app.IPAddr)

About

Simple Eureka client for Go projects

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages