connect-redis-hono
v0.2.0
Published
Redis session store-connector to work with hono-sessions
Downloads
38
Readme
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.