Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/connect-redis

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/connect-redis

TypeScript definitions for connect-redis

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
154K
increased by4.08%
Maintainers
1
Weekly downloads
 
Created

What is @types/connect-redis?

@types/connect-redis provides TypeScript type definitions for the connect-redis package, which is a Redis session store for Express. This package allows developers to use Redis as a session store in their Express applications with type safety provided by TypeScript.

What are @types/connect-redis's main functionalities?

Setting up Redis session store

This code demonstrates how to set up a Redis session store in an Express application using the connect-redis package. The RedisStore is created with a Redis client and used as the session store in the Express app.

const session = require('express-session');
const RedisStore = require('connect-redis')(session);
const redisClient = require('redis').createClient();

const app = require('express')();

app.use(session({
  store: new RedisStore({ client: redisClient }),
  secret: 'your-secret-key',
  resave: false,
  saveUninitialized: false
}));

Configuring Redis store options

This code sample shows how to configure various options for the Redis store, such as host, port, TTL (time to live), database index, password, and key prefix. These options allow for more fine-grained control over the Redis session store.

const session = require('express-session');
const RedisStore = require('connect-redis')(session);
const redisClient = require('redis').createClient();

const app = require('express')();

app.use(session({
  store: new RedisStore({
    client: redisClient,
    host: 'localhost',
    port: 6379,
    ttl: 260,
    disableTTL: false,
    db: 0,
    pass: 'your-password',
    prefix: 'sess:'
  }),
  secret: 'your-secret-key',
  resave: false,
  saveUninitialized: false
}));

Other packages similar to @types/connect-redis

FAQs

Package last updated on 19 Sep 2016

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