feat: websockets (comment posting + liking)
This commit is contained in:
parent
251609d7b8
commit
3f137e5c3c
15 changed files with 2200 additions and 5 deletions
19
website/src/lib/server/redis.ts
Normal file
19
website/src/lib/server/redis.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import Redis from 'ioredis';
|
||||
import { building } from '$app/environment';
|
||||
import { REDIS_URL } from '$env/static/private';
|
||||
|
||||
if (building) {
|
||||
throw new Error('Redis cannot be used during build');
|
||||
}
|
||||
|
||||
const redis = new Redis(REDIS_URL);
|
||||
|
||||
redis.on('error', (err) => {
|
||||
console.error('Redis connection error:', err);
|
||||
});
|
||||
|
||||
redis.on('connect', () => {
|
||||
console.log('Redis connected successfully');
|
||||
});
|
||||
|
||||
export { redis };
|
||||
Reference in a new issue