Skip to content

@purista/nats-state-store v2.0.5


PURISTA API / @purista/nats-state-store

@purista/nats-state-store

A state store for using NATS (with JetStream) as storage.

typescript
const config = {
  port: 8222
}

const store = new NatsStateStore(config)

await store.setState('stateKey',{ myState: 'value' })

let value = await store.getState('stateKey')
console.log(value) // outputs: { stateKey: { myState: 'value' } }

await store.removeState('stateKey')

value = await store.getState('stateKey')
console.log(value) // outputs: undefined

See documentation of underlaying redis lib package for detailed configuration options - NODE-REDIS.

Visit purista.dev

Follow on Twitter @purista_js
Join the Discord Chat

PURISTA - Typescript framework for IoT, microservices, and serverless | Product Hunt