REST API

<aside> πŸ’‘ REST μ•„ν‚€ν…μ²˜μ˜ μ œμ•½ 쑰건을 μ€€μˆ˜ν•˜λŠ” API(μ• ν”Œλ¦¬μΌ€μ΄μ…˜ ν”„λ‘œκ·Έλž˜λ° μΈν„°νŽ˜μ΄μŠ€)

</aside>

REST API 섀계 μ˜ˆμ‹œ

  1. URL은 λ™μ‚¬λ³΄λ‹€λŠ” λͺ…사, λŒ€λ¬Έμžλ³΄λ‹€λŠ” μ†Œλ¬Έμžλ₯Ό μ‚¬μš©ν•΄μ•Όν•¨

  2. λ§ˆμ§€λ§‰μ—λŠ” μŠ¬λž˜μ‹œλ₯Ό ν¬ν•¨ν•˜μ§€ μ•ŠλŠ”λ‹€

  3. 언더바 λŒ€μ‹  ν•˜μ΄ν”ˆμ„ μ‚¬μš©ν•œλ‹€

  4. 파일 ν™•μž₯자(.txt λ“±)λŠ” URL에 ν¬ν•¨ν•˜μ§€ μ•ŠλŠ”λ‹€

  5. ν–‰μœ„λ₯Ό ν¬ν•¨ν•˜μ§€ μ•ŠλŠ”λ‹€

    Bad Example <http://khj93.com/delete-post/1>  
    Good Example <http://khj93.com/post/1>
    

REST

<aside> πŸ’‘ μžμ›μ„ μ΄λ¦„μœΌλ‘œ κ΅¬λΆ„ν•˜μ—¬ ν•΄λ‹Ή μžμ›μ˜ μƒνƒœλ₯Ό μ£Όκ³  λ°›λŠ” λͺ¨λ“  것

</aside>

  1. Http URL을 톡해 μžμ›μ„ λͺ…μ‹œ
  2. Http Method(Get, Post, Put, Delete λ“±) 톡해
  3. ν•΄λ‹Ή μžμ›(URL)에 λŒ€ν•œ CRUD Operation을 μ μš©ν•˜λŠ” 것을 μ˜λ―Έν•¨

REST의 ꡬ성 μš”μ†Œ

<aside> πŸ’‘ 1. μžμ›(Resource) : HTTP URL

  1. μžμ›μ— λŒ€ν•œ ν–‰μœ„ : HTTP Method

  2. μžμ›μ— λŒ€ν•œ ν–‰μœ„μ˜ λ‚΄μš© : HTTP Message PayLoad

</aside>

REST의 νŠΉμ§•

  1. Server - Client(μ„œλ²„ - ν΄λΌμ΄μ–ΈνŠΈ ꡬ쑰)