Get started with lowdb CDN
MIT licensed
LowDB is a minimalist NoSQL database written in JS for local data storage.
Tags:- flat
- file
- local
- database
- storage
- JSON
- lo-dash
- lodash
- underscore
- localStorage
- embed
- embeddable
Stable version
Copied!
How to start using lowdb CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with lowdb CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/lowdb/7.0.1/low.min.js"></script>
</head>
<body>
<button id="add">Add Item</button>
<ul id="items"></ul>
<script>
const db = low('db.json'); // Initialize a new database
db.defaults({ items: [] }).write(); // Set up the items array if it doesn't exist
const items = db.get('items');
const addBtn = document.getElementById('add');
const itemsList = document.getElementById('items');
addBtn.addEventListener('click', () => {
const newItem = { id: Date.now(), name: `Item ${items.value.length + 1}` };
items.push(newItem).write();
itemsList.innerHTML += `<li>${newItem.name}</li>`;
});
items.value.forEach((item) => {
itemsList.innerHTML += `<li>${item.name}</li>`;
});
</script>
</body>
</html>
All versions
0.12.4
0.12.5
0.13.0
0.13.0-beta-5
0.13.0-beta.1
0.13.0-beta.2
0.13.0-beta.3
0.13.0-beta.4
0.13.1
0.14.0
0.15.0
0.15.1
0.15.2
0.15.3
0.15.4
0.15.5
0.16.0
0.16.1
0.16.2
0.17.0
0.17.1
0.17.2
1.0.0
2.0.0
2.0.1
2.0.2
2.0.3
2.1.0
3.0.0
4.0.0
4.0.1
5.0.0
5.0.1
5.0.2
5.0.3
5.0.5
5.1.0
6.0.0
6.0.1
6.1.0
6.1.1
7.0.0
*** 7.0.1