Open bishal1994 opened 5 years ago
Even though I enable the cors via couchConfig.set but still it doesn't sync with the couches on another domain. It only works for local network syncing . Please guys need some help in this context ,I am new to all these.
Even though I enable the cors via couchConfig.set but still it doesn't sync with the couches on another domain. It only works for local network syncing . Please guys need some help in this context ,I am new to all these.
Were you able to figure this out? Having issues with getting the config.json issues figured out
@BillMeyerRSA if you are talking about cors then I wasn't able to make it work with the cors library that I used above. So I had to make my own and it worked fine. But as of config.json I guess not switched to other libs due to lack of support here
To get CORS working with the express app, I had to use pouchdb-server's cors library:
const PouchDB = require('pouchdb');
const express = require('express');
const expressPouch = require('express-pouchdb')
const cors = require('pouchdb-server/lib/cors')
const app = express();
const pouchDBApp = expressPouch(PouchDB, {
mode: 'fullCouchDB',
configPath: './config.json' <-- defaults to this
})
app.use(cors(pouchDBApp.couchConfig)) // <-- needed
app.use(pouchDBApp);
app.listen(8000, () => {
console.log('listening on ==> http://localhost:8000')
});
With the following set in config.json:
{
"cors": {
"methods": "GET, PUT, POST, HEAD, DELETE",
"origins": "*",
"headers": "accept, authorization, content-type, origin, referer"
},
"httpd": {
"enable_cors": true
}
}
Hello , I am creating a Cordova-Android app that runs express-pouch server in its backend. After going through all the issues and discussions, I tried to implement the
I got the fauxton but the configuration tab is blank , for which I am unable to enable the CORS. Then I tried to provide the config.json file enabling the CORS but still CORS was not activated. I tried to download the pouchdb-fauxton and did the npm link and also linked to the express-pouch but no luck.
config.json
Tried to use CORS package and tried to activate in express
main.js
Please can anyone help me with activating the CORS on the express-pouch server ? Any help will be greatly appreciated.