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

[4기 한승원] URL Shortener 과제 PR입니다. #48

Open
wants to merge 20 commits into
base: seungwon
Choose a base branch
from

Conversation

SW-H
Copy link

@SW-H SW-H commented Oct 7, 2023

📌 과제 설명

사용자가 입력한 url에 대해 더 짧은 형태인 단축 url을 제공하는 서비스 입니다

👩‍💻 요구 사항과 구현 내용

  • URL 입력폼 제공 및 결과
  • URL Shortening Key는 8 Character 이내로 생성
  • 단축된 URL 요청시 원래 URL로 리다이렉트
  • 단축된 URL에 대한 요청 수 정보저장
  • Shortening Key를 생성하는 알고리즘 2개 이상 제공하며 애플리케이션 실행중 동적으로 변경 가능
    • (1) Base62
    • (2) 인덱스 번호 자체를 활용
  • IP 별 요청 횟수 제한 : Rate Limit Algorithm(Bucket4j) 사용
  • 배포 :https://shortenworld.kro.kr
Screen.Recording.2023-10-09.at.10.54.46.PM.mov
  • 초기 화면
Screenshot 2023-10-09 at 2 53 20 AM
  • 링크 단축하기 / 통계 버튼 클릭시
Screenshot 2023-10-09 at 2 53 39 AM Screenshot 2023-10-09 at 2 53 47 AM
  • 유효하지 않은 단축 url로 접속한 경우
Screenshot 2023-10-09 at 11 13 27 PM
  • 같은 IP로 너무 많은 요청을 보낸 경우
Screenshot 2023-10-09 at 10 56 30 PM

Copy link

@hyee0715 hyee0715 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

승원님 코드 잘 봤습니다! 깔끔하게 코드 잘 짜신 것 같고, 리뷰 드리면서 제가 많이 배워가는 것 같습니다 ㅎㅎ 바쁜 일정에 과제 하시느라 고생 많으셨어요~ 👍

Comment on lines 23 to 24

private String originalUrl;
Copy link

@hyee0715 hyee0715 Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엔티티에도 originalUrl에 nullable=false 처리를 해주시는 건 어떨까요?!

Suggested change
private String originalUrl;
@Column(nullable = false)
private String originalUrl;

Comment on lines +40 to +42
UrlValidator validator = new UrlValidator();

return validator.isValid(url);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UrlValidator로 유효성 검사 하는 방법도 있군요 ! 배워갑니다 👍

Comment on lines +17 to +19
private final Bucket bucket = Bucket.builder()
.addLimit(Bandwidth.simple(CAPACITY, Duration.ofMinutes(DURATION)))
.build();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bucket4j로 처리율을 제한하셨군요 👍

Comment on lines 12 to 14
Optional<Url> findByShortUrlKey(@Param("shortUrlKey") String shortUrlKey);

int countByOriginalUrl(@Param("originalUrl") String originalUrl);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Optional<Url> findByShortUrlKey(@Param("shortUrlKey") String shortUrlKey);
int countByOriginalUrl(@Param("originalUrl") String originalUrl);
Optional<Url> findByShortUrlKey(String shortUrlKey);
int countByOriginalUrl(String originalUrl);

@param을 제거해도 문제 없을 것 같습니다 ㅎㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants