# Spring Boot CRUD API ๊ตฌํ˜„
Study Repository

Spring Boot CRUD API ๊ตฌํ˜„

by rlaehddnd0422

๊ฐœ์š”

  • ๋ช…์นญ : Spring Boot ๊ฒŒ์‹œํŒ API ๊ตฌํ˜„
  • ๊ฐœ๋ฐœ ์–ธ์–ด : Java 11
  • ๊ฐœ๋ฐœ ํ™˜๊ฒฝ : Spring Boot 2.7.12
  • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค : H2
  • ํ˜•์ƒ๊ด€๋ฆฌ ํˆด : GitHub
  • ๋ฉ”์ธ ๊ธฐ๋Šฅ
    • ๊ฒŒ์‹œํŒ - CRUD ๊ธฐ๋Šฅ, ํŽ˜์ด์ง•, ๊ฒ€์ƒ‰
    • ๋Œ“๊ธ€ - CRUD ๊ธฐ๋Šฅ
    • ํšŒ์› - Security ํšŒ์›๊ฐ€์ž…, ๋กœ๊ทธ์ธ, ํšŒ์›์ •๋ณด ์ˆ˜์ •, ์œ ํšจ์„ฑ ๋ฐ ์ค‘๋ณต ๊ฒ€์‚ฌ ( ์ถ”ํ›„ Security ํ•™์Šต ์ดํ›„ ์ง„ํ–‰ ์˜ˆ์ •)

๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ์„ค๊ณ„

API ์„ค๊ณ„ - CRUD

๊ฒŒ์‹œํŒ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” RESTful API ํ•ด๋‹น API๋Š” HTTP ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜๋ฉฐ, JSON ํ˜•์‹์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›์Šต๋‹ˆ๋‹ค.

Board

๊ธฐ๋Šฅ ๋ฉ”์†Œ๋“œ URL RETURN TYPE

๋‹จ๊ฑด ์กฐํšŒ ์š”์ฒญ GET /boards/{id} BoardResponseDtos
์ „์ฒด ์กฐํšŒ ์š”์ฒญ ( ํŽ˜์ด์ง• ์ ์šฉ ) GET /boards?page={id} BoardResponseDtos
์ „์ฒด ์กฐํšŒ ์š”์ฒญ GET /boards BoardResponseDtos
๊ฒŒ์‹œ๋ฌผ ์ž‘์„ฑ POST /boards BoardResponseDto
๊ฒŒ์‹œ๋ฌผ ์ˆ˜์ • PUT /boards/{id} BoardResponseDto
๊ฒŒ์‹œ๋ฌผ ์‚ญ์ œ DELETE /boards/{id} “๊ธ€ ์‚ญ์ œ ์™„๋ฃŒ”

Member

๊ธฐ๋Šฅ ๋ฉ”์†Œ๋“œ URL RETURN TYPE

ํšŒ์› ๋“ฑ๋ก POST /member/save MemberResponseDto
ํšŒ์› ์ˆ˜์ • PATCH /member/patch/{id} MemberResponseDto
ํšŒ์› ์‚ญ์ œ DELETE /members "ํšŒ์› ์‚ญ์ œ ์™„๋ฃŒ"

Comment

๊ธฐ๋Šฅ ๋ฉ”์†Œ๋“œ URL RETURN TYPE

๋Œ“๊ธ€ ๋“ฑ๋ก POST /boards/{boardId}/comment CommentResponseDto
๋Œ“๊ธ€ ์ˆ˜์ • PATCH /boards/comment/{commentId} CommentResponseDto
๋Œ“๊ธ€ ์‚ญ์ œ DELETE /boards/comment/{commentId} "๋Œ“๊ธ€ ์‚ญ์ œ ์™„๋ฃŒ"
๋Œ“๊ธ€ ์กฐํšŒ GET /{boardId}/comment CommentResponseDtos

Pre-setting

  1. build.gradle (dependencies)
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-validation'
  1. application.yml (H2 Database - dataSource)
spring:
  datasource:
    url: jdbc:h2:tcp://localhost/~/board
    username: sa
    password:
    driver-class-name: org.h2.Driver
  jpa:
    hibernate:
      ddl-auto: create
      default_batch_fetch_size: 1000
    properties:
      hibernate:
      show_sql: true
      format_sql: true

logging.level:
  org.hibernate.SQL: debug


์ž์„ธํ•œ ์ฝ”๋“œ๋Š” ์•„๋ž˜๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”

 

GitHub - Dongwoongkim/CRUD-API

Contribute to Dongwoongkim/CRUD-API development by creating an account on GitHub.

github.com

๋ธ”๋กœ๊ทธ์˜ ์ •๋ณด

Study Repository

rlaehddnd0422

ํ™œ๋™ํ•˜๊ธฐ