Quickstart with etcd3 client
masterThe following example demonstrates how to initialize an Etcd3 client and perform basic operations: putting a value, getting a value as a string, retrieving keys by prefix, and deleting all keys.
const { Etcd3 } = require('etcd3');
const client = new Etcd3();
(async () => {
// Put a value
await client.put('foo').value('bar');
// Get a value as a string
const fooValue = await client.get('foo').string();
console.log('foo was:', fooValue);
// Get all keys with a specific prefix
const allFValues = await client.getAll().prefix('f').keys();
console.log('all our keys starting with "f":', allFValues);
// Delete all keys
await client.delete().all();
})();