1.1.1 • Published 1 month ago

hono-sessions-redis v1.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

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.

1.1.1

1 month ago

1.1.0

1 month ago

1.0.1

2 months ago

1.0.0

2 months ago