NodeJS + RxDB + Electron(持久数据)
问题描述:
我一直在玩PouchDB(使用express-pouchdb和pouchdb-find)一段时间,并意识到我需要通过Rxjs为我的Angular 5/Electron应用程序。NodeJS + RxDB + Electron(持久数据)
对于我目前的设置,我跑express-pouchdb建立持久性本地化PouchDB,然后在角度我有以下几点:
@Injectable()
export class PouchdbService {
private _localdb = 'http://localhost:3000/main';
private _pouchDb: any;
constructor() {
this._pouchDb = new PouchDB(this._localdb);
PouchDB.plugin(PouchDBFind);
this.createIndexes();
}
private createIndexes(): void {
this._pouchDb.createIndex({
index: {
fields: [ 'tags' ]
}
});
this._pouchDb.createIndex({
index: {
fields: [ 'date' ]
}
})
this._pouchDb.createIndex({
index: {
fields: [ 'title' ]
}
});
}
此通过_localdb
属性提供我的服务将快速应用。我可以保留PouchDB
快速应用程序,只需通过重写我的服务并重构代码就可以通过RxDB调用它。但是,我想我需要在每个集合上拨打sync。
虽然,我宁愿删除快速应用程序,如果有一种方式直接与RxDB持久运行。