Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #56

Merged
merged 13 commits into from
Jul 13, 2024
151 changes: 150 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pm2": "^5.3.1"
"pm2": "^5.3.1",
"redis": "^4.6.15"
},
"devDependencies": {
"eslint": "^8.57.0",
Expand Down
5 changes: 5 additions & 0 deletions src/common/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const conf = {

// social login
kakaoRestApiKey: process.env.KAKAO_REST_API_KEY,

redisHost: process.env.REDIS_HOST,
redisPort: process.env.REDIS_PORT,
redisUsername: process.env.REDIS_USERNAME,
redisPassword: process.env.REDIS_PASSWORD,
};

switch (process.env.NODE_ENV) {
Expand Down
5 changes: 4 additions & 1 deletion src/common/constants/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const ErrorMessage = Object.freeze({
EXIST_EMAIL: '이미 존재하는 이메일 입니다.',
LOGIN_ERROR: '로그인중 오류가 발생하였습니다.',
KAKAO_LOGIN_ERROR: '카카오 로그인중 오류가 발생하였습니다.',
NO_REFRESH_TOKEN: 'refresh token이 존재하지 않습니다.',
NO_REFRESH_TOKEN: '비로그인 상태입니다.',
REFRESH_TOKEN_MISMATCH: '유효하지 않은 Refresh Token입니다.',
REFRESH_TOKEN_ERROR: 'refresh token 검증중 오류가 발생하였습니다.',
DELETE_USER_ERROR: '회원탈퇴중 오류가 발생하였습니다.',

Expand All @@ -35,6 +36,8 @@ const ErrorMessage = Object.freeze({
RANK_WORDS_ERROR: '인기 검색어 조회 중 오류가 발생하였습니다.',
RELATED_WORDS_ERROR: '연관 검색어 조회 중 오류가 발생하였습니다.',
REGISTER_WORDS_ERROR: '등록 요청 중 오류가 발생하였습니다.',
EXIST_WORD: '이미 존재하는 단어입니다.',
CHECK_DUPLICATE_WORD_ERROR: '단어 중복검사중 오류가 발생하였습니다.',

// REQUEST
GET_REQUESTS_ERROR: '요청 조회중 오류가 발생하였습니다.',
Expand Down
3 changes: 3 additions & 0 deletions src/common/constants/success-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const SuccessMessage = Object.freeze({

// Word - 등록요청
REGISTER_WORDS_SUCCESS: '등록 요청 성공',

// Word - 중복검사
CHECK_DUPLICATE_REQUEST_SUCCESS: '중복 검사 성공',
});

module.exports = SuccessMessage;
20 changes: 20 additions & 0 deletions src/common/modules/redis/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const conf = require('../../config');
const { createClient } = require('redis');

const redisClient = createClient({
url: `redis://${conf.redisUsername}:${conf.redisPassword}@${conf.redisHost}:${conf.redisPort}/0`,
legacyMode: true, // 레거시 모드를 사용하는 경우에만 설정합니다.
});

redisClient.on('connect', () => {
console.info('✅ Connected to Redis');
});

redisClient.on('error', (err) => {
console.error('Redis Client Error', err);
});

redisClient.connect().then();
const redisCli = redisClient.v4;

module.exports = redisCli;
Loading