-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added redis for caching the posts data
- Loading branch information
1 parent
6739bae
commit 5c03777
Showing
7 changed files
with
1,479 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
MONGODB_URI="mongodb://127.0.0.1/wanderlust" | ||
CORS_ORIGIN="http://localhost:5173" | ||
CORS_ORIGIN="http://localhost:5173" | ||
REDIS_URL="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import dotenv from 'dotenv'; | ||
import { Redis } from 'ioredis'; | ||
dotenv.config(); | ||
function connectRedis() { | ||
if (process.env.REDIS_URL) { | ||
console.log('Redis Connected'); | ||
return process.env.REDIS_URL; | ||
} | ||
throw new Error('REDIS_URL is not defined'); | ||
} | ||
|
||
export const redis = new Redis(connectRedis(), { | ||
tls: { | ||
rejectUnauthorized: false, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.