Client API for configuring Kong admin.
- Adding APIs
- Adding Plugins per API
- Adding plugins in root (for all APIs)
- Implementing all Kong Admin APIs
- Adding UT coverage
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
$ npm install kong-admin-client --save
let KongAPI = require('kong-admin-node-client');
let kongAPI = new KongAPI({
kong_config: {
"kong_admin_api_url": "http://mky-kong:8001",
"apis": [{
"name": "myApp",
"uris": "/path/",
"upstream_url": "http://my-upstream-url.com",
"plugins": [{
"name": "rate-limiting",
"config": {
"second": "5",
"hour": "10000"
}
}]
}],
"root_plugins": [{
"name": "request-termination",
"config": {
"status_code": 403,
"message": "So long and thanks for all the fish!"
}
}]
}
});
kongAPI.createConfigurations()
.then((result) => {
// Success
})
.catch((err) => {
// Failure
});