Socket
Book a DemoInstallSign in
Socket

kingkong

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kingkong

Generator based HTTP client for the Kong API Gateway

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
2
Created
Source

King Kong Build Status

HTTP Client For Kong Api Gateway

King is a small library for managing api, consumer and plugin configuration of a KONG cluster. The primary purpose is to keep API configuration in sync by either creating or updating records using the kong admin api.

It is not intended to configure kong servers

Version 2.x targest Kong v0.10.0+, for Kong v0.9.0, use Version 1.x of this project

A kingkong instance can take multiple hosts and will round-robbin between them. Currently it will not remove hosts that fail to respond.

require('util');
var King = require('kingkong');

var k = new King({
    hosts:'http://localhost:8001, http://localhost:8002'
    ,sync:true // auto sync configuration
    ,apis:[{
          "upstream_url": "http://127.0.0.1:3000/api/v1",
          "request_path": "/fakeservice",
          "strip_request_path": true,
          "name": "integration",
          "plugins":{
            "http-log":{
              config:{
                  http_endpoint:'http://127.0.0.1:3005',
                  method:'POST'
              } 
            }
          }
    }]
    ,onSync: function(){
        console.log('synced');
    }
});

List all APIs

You can fetch all apis currently registered using the list method

var King = require('kingkong')

var k = new King({
    hosts:['http://localhost:8001', 'http://localhost:8002']
});

k.list('apis').then( console.log)

List all Plugins

You can fetch all Plugins currently registered using the list method

var King = require('kingkong')

var k = new King({
    hosts:['http://localhost:8001', 'http://localhost:8002']
});

k.list('plugins').then( console.log )

List all Consumers

You can fetch all Consumers currently registered using the list method

var King = require('kingkong')

var k = new King({
    hosts:['http://localhost:8001', 'http://localhost:8002']
});

k.list('consumers').then( console.log )

Keywords

kong

FAQs

Package last updated on 22 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts