-
Notifications
You must be signed in to change notification settings - Fork 3
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
4-1 [BE] [메인 - 인기 검색어] redis를 이용하여 상위 10개의 인기 검색어 rank를 관리하는 시스템을 만든다. #6
Conversation
popular api 기본 뼈대 설정 및 캐싱
popular api에 Redis 연결 및 get :string 요청으로 검색어 입력시에 score를 계산하고, get 요청시에 1~10위 까지의 검색 수와 키워드를 return하는 기능 추가
import { InjectRedis } from '@liaoliaots/nestjs-redis'; | ||
import Redis from 'ioredis'; | ||
@Injectable() | ||
export class PopularService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
테스트 코드를 만들어보실 수 있나요?
-
설명에 API 요청시 필요한 파라미터와 타입을 정해주시겠어요?
-
잘못된 요청이 있을 시 어떤 에러가 발생되나요? 이를 테스트 케이스에 넣으실 수 있나요?
@@ -3,6 +3,6 @@ import { AppModule } from './app.module'; | |||
|
|||
async function bootstrap() { | |||
const app = await NestFactory.create(AppModule); | |||
await app.listen(3001); | |||
await app.listen(4000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
포트 번호를 환경변수로 관리할 수 있나요?
private populars: Popular[] = []; | ||
async getAll() { | ||
this.populars = []; | ||
const topTen = await this.redis.zrevrangebyscore('Top10', '+inf', 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top10
key를 상수로 관리할 수 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
갓준엽
.czrc
Outdated
@@ -0,0 +1 @@ | |||
{ "path": "cz-conventional-changelog" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 파일은 제가 .gitignore에 추가해놨으니 날려주시면 됩니당
backend/package.json
Outdated
"cache-manager": "^5.1.3", | ||
"cache-manager-redis-store": "^3.0.1", | ||
"ioredis": "^5.2.4", | ||
"redis": "^4.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분은 필요한 패키지만 정리해주실 예정
backend/src/app.module.ts
Outdated
imports: [ | ||
RedisModule.forRoot({ | ||
config: { | ||
host: 'localhost', | ||
port: 3003, | ||
}, | ||
}), | ||
], | ||
controllers: [PopularController], | ||
providers: [PopularService], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
popular controller에 module이 생기고 redisModule import 할 예정
여기서는 popularModule import 할 예정
개요
http://localhost:4000/popular
http://localhost:4000/popular/{search}
4000번 포트의 인기 검색어의 데이터를 받아 올 수 있는 api 개발
작업사항
리뷰 요청사항