【问题标题】:Sync a PouchDB on Nodejs server (without Pochdb-server or Couch)在 Node Js 服务器上同步 PouchDB(没有 Pouchdb-server 或 Couch)
【发布时间】:2014-09-23 17:55:00
【问题描述】:

我想将我的 Nodejs 服务器上的 PouchDb 与前端的 IndexedDb 同步()。

但是:我不使用 Couch 或 Pouchdb-server

在后端我正在运行:

var pouch = require('pouchdb')
var db = new pouch('fuu');

test.app.use('/sync'),function(req,res,next){console.log('Woop woop');
db.info(function)(err,info) {return res.send('info')})
});

// same problem with : db.allDocs(..);

在前端:

var db = new PouchDB('ba');
var remoteCouch = ("http://localhost:3000/sync")

var sync = function() {

        var opts = {live: true};
        db.sync(remoteCouch, opts);}

sync();

但现在控制台中无休止地调用“Woob woob”,没有任何同步的..

有人知道我做错了什么吗?

【问题讨论】:

    标签: node.js pouchdb


    【解决方案1】:

    您需要正确映射 PouchDB 将用于同步的所有 url。我假设您的后端是一个错字,而您在后端使用的是var db = new PouchDB('fuu'),对吗?

    PouchDB-Server 已将其使用的 url 路由逻辑提取到另一个模块 https://github.com/pouchdb/express-pouchdb,自述文件应该为您提供如何执行此操作的示例,您不需要 pouchdb-server 提供的额外功能

    【讨论】:

    • 是的,有一个错字-.-,感谢链接它有效:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-16
    • 1970-01-01
    • 2017-05-03
    • 2014-12-23
    • 2018-10-28
    • 1970-01-01
    相关资源
    最近更新 更多