Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode authored Oct 18, 2023
1 parent d0fb65a commit 3e588f8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
> Simple to use local JSON database. Use native JavaScript API to query. Written in TypeScript. 🦉
```js
// Read or create db.json
const db = await JSONPreset('db.json', { posts: [] })

// Edit db.json content using plain JavaScript
db.data.posts.push({ id: 1, title: 'lowdb is awesome' })
db.data
.posts
.push({ id: 1, title: 'lowdb is awesome' })

// Save to file
db.write()
Expand Down Expand Up @@ -61,6 +66,7 @@ _Lowdb is a pure ESM package. If you're having trouble using it in your project,
```js
import { JSONPreset } from 'lowdb/node'

// Read or create db.json
const defaultData = { posts: [] }
const db = await JSONPreset('db.json', defaultData)

Expand Down

0 comments on commit 3e588f8

Please sign in to comment.