Skip to content

1회차#8

Open
HyerimH wants to merge 3 commits intoChuseok22:mainfrom
HyerimH:hyerim
Open

1회차#8
HyerimH wants to merge 3 commits intoChuseok22:mainfrom
HyerimH:hyerim

Conversation

@HyerimH
Copy link
Copy Markdown

@HyerimH HyerimH commented Sep 28, 2024

No description provided.


### VS Code ###
.vscode/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

악 이거 넣는거 까먹었다 감사합니다~

Comment on lines +27 to +28
User savedUser = userService.saveUser(username, password, nickname);
return savedUser;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

이거는 수정할 부분은 아니고 참고하면 좋은 부분이라 comment 남겨요
UserService의 saveUser라는 메서드 리턴값을 보면 User를 리턴하죠?
그래서 27, 28번 째 줄을 하나로 합칠 수 있어요
savedUser라는 변수를 할당해서 지금처럼 리턴해도 되고
코드를 한줄이라도 줄이고 싶다면
return userService.saveUser(username, password, nickname); 이런식으로 줄이는 것도 가능합니다

물론 이거는 본인 코딩 스타일이라 굳이 어떤 방법이 좋다 이건 없어

Comment on lines +23 to +25
@RequestParam String username,
@RequestParam String password,
@RequestParam String nickname) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good!
생략해도 무관한 부분이라 굳이 수정 안해도 괜찮아~
@RequestParam("username") String username,
@RequestParam("password") String password,
@RequestParam("nickname") String nickname

생략된 부분이 있다는 거 꼭 알고 쓰면 됩니다~

}

@GetMapping("/id/{id}")//데이터 조회할 때
public User getUserById(@PathVariable Long id){//변수 값 추출
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

여기도 마찬가지
생략된 부분이 있다는 것만 알고 공부하면 돼~
수정 안해도 괜찮아
@PathVariable("id") Long id

@Chuseok22
Copy link
Copy Markdown
Owner

Good!! 수정할 부분은 없어요
@ReqestMapping 쓴 부분 좋습니다~
대신 잘 모르는 어노테이션은 꼭!! 찾아보고 사용해주세요

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants