Skip to content

Redis session store-connector to work with hono-sessions

License

Notifications You must be signed in to change notification settings

crossunit/connect-redis-hono

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

connect-redis-hono

Redis session store-connector to work with hono-sessions

Installation

$ bun i connect-redis-hono

Usage

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

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

const store = new BunRedisStore({
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 node-redis, but making it compatible with ioredis is trivial, feel free to make a PR.

License

MIT

About

Redis session store-connector to work with hono-sessions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published