0.0.2 • Published 6 years ago

cookie-redis-store v0.0.2

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

Cookie Redis Store

Supports Redis >= 2.6.12 and (Node.js >= 6).

Description

Another redis store for tough-cookie module.

Install

$ npm install cookie-redis-store

Basic Usage

const rp = require('request-promise');

const CookieRedisStore = require('cookie-redis-store');

const jar = rp.jar(new CookieRedisStore());

(async () => {
  const qs = {
    key: 'value',
    anotherkey: 'something',
    someelse: 'content',
  };

  const response = await rp('https://httpbin.org/cookies/set', { qs, jar, json: true });

  console.log(response);
})();

Options

const rp = require('request-promise');

const CookieRedisStore = require('cookie-redis-store');

// Connect to 127.0.0.1:6380, db 4, using password "authpassword" and stores on key "my-cookie"
const jar = rp.jar(new CookieRedisStore('redis://:authpassword@127.0.0.1:6380/4', 'my-cookie'));

(async () => {
  const qs = {
    key: 'value',
    anotherkey: 'something',
    someelse: 'content',
  };

  const response = await rp('https://httpbin.org/cookies/set', { qs, jar, json: true });

  console.log(response);
})();