【pouchdb-可视化工具 】
2024-05-13 本文已影响0人
wn777
![](https://img.haomeiwen.com/i17741696/fb46e244e40ada08.png)
最近使用pouchdb,想找个其对应的可视化工具,可以对数据库进行操作。
找了好久才找到,网上有说先同步到couchdb,再用couchdb的可视化工具查看,其实没有那么麻烦,pouchdb的可视化工具其实藏在另外的pouchdb-server项目中。
最开始走了弯路了,这里记录也和大家分享下 。
pouchdb
先插入一条数据
import PouchDB from 'pouchdb';
import process from 'process';
let prefix = ${Your_DB_Path};
let db = new PouchDB(`${prefix}/account`, {adapter: 'leveldb'});
db.post({
name: "John Doe",
}).then(function (response) {
// handle response
console.log(response);
}).catch(function (err) {
console.log(err);
});
可视化查看
安装 pouchdb-server
npm install -g pouchdb-server
启动
npx pouchdb-server --dir ${Your_DB_Path}
访问:http://127.0.0.1:5984/_utils/#/_all_dbs
可以看到刚刚创建的数据库 ,
![](https://img.haomeiwen.com/i17741696/623b49cfcb9b2573.png)
点进去还可以找到刚刚插入的数据
![](https://img.haomeiwen.com/i17741696/4521214148bde9d5.png)
点进去,可以进行数据修改。
![](https://img.haomeiwen.com/i17741696/58d5c3b15da31ca6.png)
标签:#gui , #可视化工具, #pouchdb, #pouchdb-server