Vinz243
Vinz243

Reputation: 9938

How to configure CouchDB from my nodejs app

I'm trying to create a self-hosted app. This app would provide a custom express server with some routes and also provides a CouchDB access using pouchdb-server. I would like the node server to be able to configure the database and create the admin username/password, and then create the roles functions. How can I configure CouchDB from my nodejs app?

I would like to:

Please note that I can't do direct http requests to CouchDB, since I'm using pouch-db-express in my node app to serve the db to the client, and I would like my express app to configure the couchDB instance managed by pouchdb-express

Upvotes: 3

Views: 740

Answers (1)

Jonathan Hall
Jonathan Hall

Reputation: 79586

  1. Stop admin party and create an admin with a password

    I'm pretty sure the only way to interact with the _config endpoint is with HTTP, as I see no config plugin on the plugins page. Even if there was a plugin, it would use HTTP. Is there some reason HTTP is actually not possible? Or you just don't want to use it?

  2. Create users roles

    The PouchDB authentication plugin can do this for you.

  3. Set up permissions

    The authentication plugin also gives you access to the _security endpoint for this. Then you'll also need to create the appropriate design documents, using the standard put() API.

Upvotes: 2

Related Questions