Socket
Socket
Sign inDemoInstall

couchdb-mkdb

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchdb-mkdb

Utility to create couchdb databases easier.


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

couchdb-mkdb

couchdb-mkdb makes it easy to create databases and stream couchdb's response.

Installation

$ npm i -S couchdb-mkdb

Usage

Express example

This express route creates new databases on every request.

...
app.post('/', (req, res, next) => {
  let name = 'mydb-' + uuid.v1();
  let opts = {

    // `couchdb` and `security` are special options ...
    couchdb: app.get('couchdb'),
    security: {
      admins: {names: [req.user.name], roles: []},
      members: {names: [], roles: []}
    },

    // ... all other options are passed to the underlaying `request` function.
    // See https://github.com/request/request.
    oauth: app.get('auth')
  };

  // Use the mkdb utility to create the database
  mkdb(name, opts, (err, response) => {
    if (err) return next(err);

    // Just crap couchdb's response and push it down to the client
    response.pipe(
      res.set(response.headers)
        .status(response.statusCode)
    );
  });
});

API

mkdb(name, [opts], callback)

  • name The name of the database
  • opts Optional options object. See below
  • callback Function with the signature fn(error, response)

Available options are:

  • couchdb The url to the couchdb
  • security The security rules to apply to the database. See Couchdb security

All other options are passed to the underlaying request function.

Keywords

FAQs

Package last updated on 04 Nov 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc