3.0.0 • Published 6 years ago

botkit-storage-couchdb v3.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

Botkit Storage Couchdb

A Couchdb storage module for botkit

Installation

$ npm install botkit-storage-couchdb --save

Usage

Require botkit-storage-couchdb and pass your config options. Then pass the returned storage when creating your Botkit controller. Botkit will do the rest!

const Botkit = require('botkit'),
    couchDbStorage = require('botkit-storage-couchdb')("localhost:5984/botkit"),
    controller = Botkit.slackbot({
        storage: couchDbStorage
    });
    
// then you can use the Botkit storage api, make sure you have an id property
var beans = {id: 'cool', beans: ['pinto', 'garbanzo']};

controller.storage.teams.save(beans);

controller.storage.teams.get('cool', (error, team) => {
    console.log(team);
});

Options

You can pass any options that are allowed by nano.

The url you pass should contain your database.

couchDbStorage = require('botkit-storage-couchdb')("localhost:5984/botkit")

To specify further configuration options you can pass an object literal instead:

// The url is parsed and knows this is a database
couchDbStorage = require('botkit-storage-couchdb')({ 
    "url": "http://localhost:5984/botkit", 
    "requestDefaults" : { "proxy" : "http://someproxy" },
    "log": function (id, args) {
        console.log(id, args);
    }
});
3.0.0

6 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago