Back
Version 3
12/4/2023
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { BlobPreset } from "https://esm.town/v/pomdtr/lowdb";
type Post = {
id: number;
title: string;
};
type Data = {
posts: Post[];
};
// // use the val name as a key ("@pomdtr/testLowDB")
// const { key } = extractValInfo(import.meta.url);
// // Read or Create DB from blob
// const db = await BlobPreset<Data>(key, { posts: [] });
// // Edit db.json content using plain JavaScript
// db.data
// .posts
// .push({ id: db.data.posts.length + 1, title: "lowdb is awesome" });
// // Save to blob
// await db.write();
// // Check that the db has been updated
// const db2 = await BlobPreset(key, { posts: [] });
// console.log(db2);
// export { { key } };
nbbaier-lowdbtest.web.val.run
Updated: July 4, 2024