2023-04-18 03:06:37 +00:00
|
|
|
import { createClient } from 'redis';
|
2023-04-18 01:49:20 +00:00
|
|
|
|
2023-05-09 01:23:41 +00:00
|
|
|
const redisUrl = process.env.REDIS_URL || 'redis://localhost:6379';
|
|
|
|
|
2023-04-18 01:49:20 +00:00
|
|
|
// Create a new Redis client
|
2023-05-09 01:23:41 +00:00
|
|
|
const client = createClient({ url: redisUrl });
|
2023-04-18 01:49:20 +00:00
|
|
|
|
|
|
|
// Log any Redis errors to the console
|
|
|
|
client.on('error', (error) => {
|
2023-04-18 03:06:37 +00:00
|
|
|
console.error('Redis Client Error', error);
|
2023-04-18 01:49:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Export the Redis client
|
|
|
|
export default client;
|