Dionne Davenport
Essentially hstore with JSON val
$ npm install dionne-davenport --save
Basic setting/getting
const Dionne = require('dionne-davenport')
const opts = {
appName: 'myApp',
url: process.env.DATABASE_URL
}
const store = await Dionne(opts)
await store.set('as', 'if')
const result = await store.get('as')
console.log(result)
Batch setting/getting
const items = {
foo: 'bar',
ping: {
beep: [ 'boop', 'bop' ]
}
}
await store.setAll(items)
const result = await store.getAll(Object.keys(items))
console.log(result)
Deletion
let item
await store.set('delMe', 'foo')
item = await store.get('delMe')
console.log('delMe')
await store.del('delMe')
item = await store.get('delMe')
console.log(item)
Tests
Create your test PostgresSQL database and user and create a test.env file for environment constiables
$ createuser myApp
$ createdb myApp
$ echo "DATABASE_URL=postgres://myApp:Ffoodk@localhost:5432/myApp" >> test/test.env
$ echo "NODE_ENV=test" >> test/test.env
$ echo "APP_NAME=appName" >> test/test.env
$ npm test