Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
add-cors-to-couchdb
Advanced tools
CouchDB doesn't come with CORS enabled by default. This is a problem for libraries like PouchDB, which depend on being able to access CouchDB no matter what URL it's being served from.
This script fixes that.
npm install -g add-cors-to-couchdb
add-cors-to-couchdb
or if it is a remote database:
add-cors-to-couchdb http://me.iriscouch.com -u myusername -p mypassword
On Ubuntu the default Node.js library is called nodejs
instead of node
due to a naming conflict. To run on Ubuntu, you'll need to do:
sudo apt-get install nodejs-legacy
This script will simply add some generic CORS configuration to your CouchDB. You could also do it yourself trivially using curl
:
HOST=http://adminname:password@localhost:5984 # or whatever you got
curl -X POST $HOST/_config/httpd/enable_cors -d '"true"'
curl -X PUT $HOST/_config/cors/origins -d '"*"'
curl -X PUT $HOST/_config/cors/credentials -d '"true"'
curl -X PUT $HOST/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -X PUT $HOST/_config/cors/headers -d '"accept, authorization, content-type, origin, referer"'
You can always change the configuration later by simply going to http://localhost:5984/_utils/config.html and updating the values. However, these default options are good for getting up and running.
FAQs
add CORS to couchdb
The npm package add-cors-to-couchdb receives a total of 342 weekly downloads. As such, add-cors-to-couchdb popularity was classified as not popular.
We found that add-cors-to-couchdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.