npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

couchdb-love

v0.0.1

Published

couchdb love requests with promises

Downloads

3

Readme

couchdb-love

simple couchdb love client

  • request-promise centric

    • build requestOptions as for request-promise.
  • cookie authentication

    • handles session management (creation & persistence)
    • inserts sessionid into headers.
    • increased security
    • must configure couchdb for cookie authentication
  • performance logging

    • query performance info logged at:
      • {logpath}/stderr.log (error logging).
      • {logpath}/stdout.log
    • log records are JSON objects.

configurations

local.ini

[couch_httpd_auth]
allow_persistent_cookies = true

config

{
  host: 'http://localhost',
  port: 5984,
  username: 'username',
  password: 'password',
  logpath: __dirname + '/../log'
};

logpath: where peformance log statements are stored.

1 init couchdb-love

const CLove = require('../lib')(Config);
// or
const CLove2 = new require('../lib')(Config2);

note use "new" when muliple users.

2 Build a request with a promise

const requestOptions = (session) => {

    return new Promise((resolve, reject) => {

        const options = {
            method: 'PUT',
            uri: Config.host + ':' + Config.port + '/test_uuser',
            headers: {
                'X-Couchdb-WWW-Authenticate': 'Cookie',
                'Content-Type': 'application/x-www-form-urlencoded',
                'Cookie': 'AuthSession=' + session.cookie
            },
            resolveWithFullResponse: true,
            json: true, // Automatically parses the JSON string in the response
            requestError: 'Failed to destroy database \"test_uuser\".'  // @note must have for error message.
        };

        resolve(options);
    });

request options must be built using a promise as illustrated above. couchdb-love utilizes promises and generator functions to build a simple request lifecycle. Lifecycle:

  • generate session
  • load requestOptions
  • begin logging
  • execute request
  • tail - print log statements
  • return result to user

If you do not use a promise to load requestOptions, the lifecycle will break.

3 next pass requestOptions to couchdb-love

    const CLove = require('couchdb-love')(Config);

    CLove.request(requestOptions, (err, result) => {

        expect(result.statusCode).to.equal(201);
        done(err);
    });

4 relax and make more request

Tests

100% test coverage node v6.9.4

depends on:

  • couchdb-session
  • itera
  • request
  • request-promise