2.0.0 • Published 6 years ago

auzy-storage-redis v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

auzy redis storage

Redis storage package for auzy based on ioredis

Installation and configuration

To use redis as a storage with auzy you have to install it into your project:

yarn add auzy-storage-redis
npm i --save auzy-storage-redis

In most cases you can just set auzy environment hint without ioredis configuration.

const express = require('express');
const auzy = require('../index');

const auzyConfig = {
    session: {
        // session handler configuration here
    },
};
const auzyEnvironment = {
    framework: 'express',
    storage: 'redis',
};

const server = express();
server.use(auzy(auzyConfig, auzyEnvironment));
server.listen(8080);

Advanced usage example

In case if you have unusual Redis connection settings you can specify them in the auzy storage configuration. Storage config is an ioredis config object.

const express = require('express');
const auzy = require('../index');

const auzyConfig = {
    session: {
        // session handler configuration here
    },
    storage: {
        port: 6379,          // Redis port
        host: '127.0.0.1',   // Redis host
        family: 4,           // 4 (IPv4) or 6 (IPv6)
        password: 'auth',
        db: 0,
    },
};
const auzyEnvironment = {
    framework: 'express',
    storage: 'redis',
};

const server = express();
server.use(auzy(auzyConfig, auzyEnvironment));
server.listen(8080);
2.0.0

6 years ago