所以我正在做一个示例应用程序,它将具有脱机功能。Couchbase服务器和同步网关不同步
我在我的本地机器上托管的沙发服务器上有两个桶,第一个是restful-sample
,另一个是sync_gateway
。现在我已经为后端编写了api代码,而且CRUD工作正常。对于restful-sample
我有这个config.json
位于我的项目。
- app
- models
- node_modules
- public
- routes
- app.js
- config.json <-- this one
...
config.json
{
"couchbase": {
"server": "127.0.0.1:8091",
"bucket": "restful-sample",
"password": "123456"
}
}
然后,我也有我的机器上安装了sync_gateway
,我也有这样的json配置也位于同一个项目。
- app
- models
...
- config.json
- syncgw-config.json <-- this one
...
syncgw-config.json
{
"interface": ":4987",
"adminInterface": ":4988",
"log": ["CRUD", "CRUD+", "HTTP", "HTTP+", "Access", "Cache", "Shadow", "Shadow+", "Changes", "Changes+"],
"databases": {
"cool_app": {
"server": "http://localhost:8091",
"bucket": "sync_gateway",
"sync": `function(doc) {
channel(doc.channels);
}`,
"users": {
"GUEST": {
"disabled": false,
"admin_channels": ["*"]
}
},
"shadow": {
"server": "http://localhost:8091",
"bucket": "restful-sample",
"password": "cuaju_05"
}
}
}
}
第一桶restful-sample
上已经有一些数据,通过I创建的API,直接从客户机侧编写的存储。
当我试图运行./sync_gateway '/var/www/html/couchtest/syncgw-config.json'
同步网关顺利上http://localhost:4987/cool_app/
但文件从桶里restful-sample
运行不同步,也没有显示在sync_gateway
斗couchbase服务器上我的机器上本地运行。
这里我的问题是,我做对了吗?我期待看到从restful-sample
到snyc_gateway
桶的数据,我是否期待太多? (笑)
无论如何,在此先感谢。