inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

인프런 워밍업 3기 발자국 남기기!

최범수
0

📌 이번 주 학습 내용 정리

1. 웹 서비스의 구성 요소


2. 웹 프레임워크와 Spring Boot


3. HTTP와 REST API

@RestController
@RequestMapping("/users")
class UserController(private val userService: UserService) {

    @GetMapping("/{id}")
    fun getUser(@PathVariable id: Long): ResponseEntity<UserResponse> {
        val user = userService.getUserById(id)
        return ResponseEntity.ok(user)
    }

    @PostMapping
    fun createUser(@RequestBody request: UserRequest): ResponseEntity<UserResponse> {
        val createdUser = userService.createUser(request)
        return ResponseEntity.status(HttpStatus.CREATED).body(createdUser)
    }
}

4. 패키지 구조 (application, domain, infra, presentation 방식)

src/
 ├── main/
 │    ├── kotlin/com/example/project
 │    │    ├── application/   # Use case 및 비즈니스 로직
 │    │    │    ├── service/  # 서비스 계층
 │    │    │    └── usecase/  # 특정 Use Case 구현
 │    │    ├── domain/        # 도메인 계층 (Entity, Aggregate, VO 등)
 │    │    │    ├── model/    # 엔티티 및 VO 정의
 │    │    │    ├── repository/ # 도메인 리포지토리 인터페이스
 │    │    ├── infra/         # 인프라 계층 (DB, 외부 API, 메시징 등)
 │    │    │    ├── repository/ # JPA 구현체 (Spring Data JPA)
 │    │    │    ├── config/   # 환경 설정 (Security, JWT, Swagger 등)
 │    │    │    └── external/ # 외부 API 연동
 │    │    ├── presentation/  # 프레젠테이션 계층 (Controller 및 DTO)
 │    │    │    ├── controller/  # REST API Controller
 │    │    │    ├── request/  # 요청 객체 (Request DTO)
 │    │    │    └── response/ # 응답 객체 (Response DTO)
 │    │    ├── ProjectApplication.kt  # Spring Boot 진입점
 │    ├── resources/
 │    │    ├── application.yml (설정 파일)
 │    │    └── static/ (정적 파일 - 이미지, JS, CSS 등)
 ├── test/  (테스트 코드)

5. 테이블 설계

@Entity
@Table(name = "users")
data class User(
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    val id: Long = 0,

    @Column(nullable = false, unique = true)
    val username: String,

    @Column(nullable = false)
    val password: String
)
@Repository
interface UserRepository : JpaRepository<User, Long> {
    fun findByUsername(username: String): User?
}




이번 주 회고 사항

잘한 점:

강의를 잘 따라갔고 코틀린을 공부하면서 많은 시간을 보냈기 때문에 뿌듯한 하루가 되었던 것 같다.

 

아쉬운 점:

정리를 다 못해서 아쉬웠다.. 다음엔 더 열심히 할 것이다!

 

다음 주 계획
강의 밀리지 말고 정해진 분량 정해진 날 듣기!

발자국

답변 0