Skip to content

Redis store adapter for hono-sessions, on Node.js (ioredis)

Notifications You must be signed in to change notification settings

FaureAlexis/hono-sessions-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hono-sessions-redis

Redis session store-connector to work with hono-sessions This repo is a fork of connect-redis-hono

Installation

$ pnpm add hono-sessions-redis

Usage

import { Hono } from "hono";
import { sessionMiddleware } from "hono-sessions";
import { RedisStoreAdapter } from "hono-sessions-redis";

// ...
// create your RedisClient and connect to your redis server
// ...

const store = new RedisStoreAdapter({
prefix: "AppPrefix:", 
ttl: 3600, // seconds
client: RedisClient, 
});

const app = new Hono();

app.use(sessionMiddleware({
    store, // pass your store
    // ...other session options    
}));

app.get("/", (ctx) => {
    return ctx.text("Session data stored on Redis");
});

export default {
    port: 3000,
    fetch: app.fetch,
  };
  

Redis client

As of right now this package is only compatible with ioredis.

About

Redis store adapter for hono-sessions, on Node.js (ioredis)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published