Skip to content

Instantly share code, notes, and snippets.

@phpsmarter
Created January 24, 2022 02:23
Show Gist options
  • Save phpsmarter/f8c3bf5c261fb46f5d9283a96792244d to your computer and use it in GitHub Desktop.
Save phpsmarter/f8c3bf5c261fb46f5d9283a96792244d to your computer and use it in GitHub Desktop.
// local, node database
import level from 'pouchdb-adapter-leveldb'
import Pouchy from 'pouchy'
Pouchy.plugin(level)
type Fruit = {
type: string,
tastes: string
} const fruit = new Pouchy<Fruit>({name : 'fruit'})
const orange = await fruit.save({type : 'orange', tastes : 'delicious'})
console.log(orange)
/**
{
type: 'orange',
tastes: 'delicious',
_id: 'EA1F2B55-2482-89C6-907E-6F938C59F734',
_rev: '1-f60b9b7d775a89d280e1f4c07122b863'
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment