NATS storage adapter for the awesome keyv.
yarn add keyv keyv-nats
import Keyv from 'keyv'
import KeyvNats from 'keyv-nats'
const keyvNats = new KeyvNats({ servers: "localhost:4222" });
await keyvNats.connect();
const keyv = new Keyv({ store: keyvNats })
const key = 'foo'
const value = 'bar'
await keyv.set(key, value)
await keyv.get(key)
keyvNats.disconnect();
NATS Keyv storage adapter uses Testcontainers for NodeJS in order to run NATS server during test automation. Please check general Docker requirements of Testcontainers to run those in your local docker environment.
# nothing else required as testcontainer will start and stop nats
yarn test