GithubHelp home page GithubHelp logo

pouchdb / add-cors-to-couchdb Goto Github PK

View Code? Open in Web Editor NEW
132.0 132.0 20.0 36 KB

CLI to add a good default CORS configuration to CouchDB

License: Apache License 2.0

JavaScript 83.99% Shell 16.01%

add-cors-to-couchdb's Introduction

PouchDB โ€“ The Database that Syncs!

Build Status Coverage Status Greenkeeper badge npm version jsDelivr Hits

PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.

PouchDB was created to help web developers build applications that work as well offline as they do online.

Using PouchDB

To get started using PouchDB, check out the web site and API documentation.

Getting Help

The PouchDB community is active in #pouchdb on the CouchDB Slack, in the Google Groups mailing list, and on StackOverflow. Or you can mastodon @pouchdb!

If you think you've found a bug in PouchDB, please write a reproducible test case and file a Github issue.

Prerelease builds

If you like to live on the bleeding edge, you can build PouchDB from source using these steps:

git clone https://github.com/pouchdb/pouchdb.git
cd pouchdb
npm install

After running these steps, the browser build can be found in packages/node_modules/pouchdb/dist/pouchdb.js.

Changelog

PouchDB follows semantic versioning. To see a changelog with all PouchDB releases, check out the Github releases page.

For a concise list of breaking changes, there's the wiki list of breaking changes.

Keep in mind that PouchDB is auto-migrating, so a database created in 1.0.0 will still work if you open it in 4.0.0+. Any release containing a migration is clearly marked in the release notes.

Contributing

We're always looking for new contributors! If you'd like to try your hand at writing code, writing documentation, designing the website, writing a blog post, or answering questions on StackOverflow, then we'd love to have your input.

If you have a pull request that you'd like to submit, please read the contributing guide for info on style, commit message format, and other (slightly!) nitpicky things like that. PouchDB is heavily tested, so you'll also want to check out the testing guide.

add-cors-to-couchdb's People

Contributors

calvinmetcalf avatar dandamian avatar danhawkes avatar greenkeeper[bot] avatar nolanlawson avatar sajinshrestha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

add-cors-to-couchdb's Issues

SignUP Error

I do that:

db.signUp(payload.email, payload.password, {
        metadata: {
          email: payload.email,
          firstName: payload.firstName,
          lastName: payload.lastName
        }
      }).then((response) => {

Have this:
screen shot 2018-02-11 at 18 51 00

I did everything with CORS, even installed Chrome extension but can make it works. Any suggestions?

Error 500 when running

I was following this guide and in the Set up CORS section, I'm having troubles. I installed this package, but when I try to run I get this error

Error: status 500 {"error":"error","reason":"eacces"}

I've tried with node v6.0.0 and v4.4.0, I get the same error. Nove v6 give this, apparently useless, stacktrace

at /home/yerko/.nvm/versions/node/v6.0.0/lib/node_modules/add-cors-to-couchdb/index.js:45:13
    at process._tickCallback (internal/process/next_tick.js:103:7)

Is this an error with my couchDB set up? I know is properly installed, I can access to http://localhost:5984/_utils/fauxton/#/ with no problem. What could be the issue?

ps: I've installed couchDB following this guide. I'm using Debian 8

Ran into trouble with CouchDB 2.0 preview

(Oops hit enter not tab.)

I didn't see this issue already opened, so I thought I'd mention that this doesn't seem to work with CouchDB master (the 2.0 preview, pulled & compiled Oct 6, 2015)

Below is the output. I tried both with the haproxy front end on port 5985, and with one of the server nodes on port 15984, and again without a password.

james@emma couchdb[master]$ add-cors-to-couchdb http://root:[email protected]:5985
[Error: got a 404 code]
james@emma couchdb[master]$ add-cors-to-couchdb http://root:[email protected]:15984
[Error: got a 404 code]
james@emma couchdb[master]$ add-cors-to-couchdb http://127.0.0.1:15984
[Error: got a 302 code]

(Yeah, that's the auto-generated root password...it is okay because it generates a new one every time.)

Had no problems at all with this on 1.6.x, of course.

Error accessing cloudant db URL from node

Hi, I get this error accessing my db URL in cloudant: (URL has been edited)

$ add-cors-to-couchdb https://XXX83e-5af3-41de-b499-dae33fb39b69-bluemix.cloudant.com/DBNAME
Error: status 400 {"error":"illegal_docid","reason":"Only reserved document ids may start with underscore."}

at /home/cos/.npm-global/lib/node_modules/add-cors-to-couchdb/index.js:45:13
at process._tickCallback (internal/process/next_tick.js:109:7)

Error: status 400 {"error":"illegal_docid","reason":"Only reserved document ids may start with underscore."}

I even tried with user & Anon Full Access

The URL works fine in browser

Avoid native promises to support node 0.10

Saw this error in a PouchDB travis job:

/home/travis/build/pouchdb/pouchdb/node_modules/add-cors-to-couchdb/node_modules/node-fetch/index.js:40
        throw new Error('native promise missing, set Fetch.Promise to your favorite 
              ^
Error: native promise missing, set Fetch.Promise to your favorite alternative
    at new Fetch (/home/travis/build/pouchdb/pouchdb/node_modules/add-cors-to-couchdb/node_modules/node-fetch/index.js:40:9)
    at Fetch (/home/travis/build/pouchdb/pouchdb/node_modules/add-cors-to-couchdb/node_modules/node-fetch/index.js:36:10)
    at addCors (/home/travis/build/pouchdb/pouchdb/node_modules/add-cors-to-couchdb/index.js:74:10)
    at Object.<anonymous> (/home/travis/build/pouchdb/pouchdb/node_modules/add-cors-to-couchdb/bin.js:27:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

So apparently the fix is to set global.Promise to use a promise shim (in our case, lie) before we use node-fetch.

How to execute the command on windows?

C:\CouchDB>npm install -g add-cors-to-couchdb
C:\Users\pc\AppData\Roaming\npm\add-cors-to-couchdb -> C:\Users\pc\AppData\Roaming\npm\node_modules\add-cors-to-couchdb\bin.js

C:\CouchDB>add-cors-to-couchdb
Der Befehl "add-cors-to-couchdb" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

C:\CouchDB>

Doesn't work on Ubuntu

On Ubuntu node is called nodejs due to a naming conflict, so the #! line causes the script to just exit out.

Installing to irsicouch.com

Hi there,

I have a problem when I try to install cors to iriscouch, using this npm application. I havegot a 401 error and my credential are the correct.

What can I do?

Akseli

P.S.: sorry for my English

Invalid setup: you cannot set origins=* and credentials=true at the same time

From CORS specification:

If the resource supports credentials add a single Access-Control-Allow-Origin header, with the value of the Origin header as value, and add a single Access-Control-Allow-Credentials header with the case-sensitive string "true" as value.

Otherwise, add a single Access-Control-Allow-Origin header, with either the value of the Origin header or the string "*" as value.

The string "*" cannot be used for a resource that supports credentials.

This is also noted in CouchDB docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.