Redis plugin for Elysia.js
bun add @atakan75/elysia-redis
import { Elysia, t } from 'elysia';
import { redis } from '@Atakan75/elysia-redis';
const app = new Elysia()
.use(redis())
.get('/', async ({ redis }) => {
await redis.set('elysia', 'redis', 60);
const data = await redis.get('elysia');
if (!data) {
throw new Error('No data found');
}
return data;
});
console.log(`Listening on http://${app.server!.hostname}:${app.server!.port}`)
Checkout the tests folders on github.
First of all, if you define REDIS_URL in the env file, it will take the value you enter. If you do not define anything, it will connect to the redis server installed in your local.