Skip to content

nwarlen/consul-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

consul-client Build Status

Client code for service discovery and invocation

Example

'use strict';

var consulClient = require('consul-client');

var consulHost = 'my.consul.com'; // e.g 172.x.x.x:8500
var consulRequest = consulClient(consulHost);

var config = {
  serviceName: 'users',
  version: '1.0.0',
  endpoint: 'users/login',
  method: 'POST',
  body: {
    username: 'will',
    password: 'p@ssword'
  }
};

// Discovers an instance of the users service
// and POSTs body to it's /users/login route.
consulRequest(config)
  .then(console.log) // log successes
  .catch(console.log); // catch and log all errors

About

Client code for service discovery and invocation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%