๐Ÿ“šย Reference


๐Ÿ“œย Chapter


API Routes

Server Component

โ€ฃ

Server Actions

Route Handlers


ํŠน์ง•


ํŒŒ์ผ๋ช… ๊ทœ์น™

Route Handlers๋Š” app ๋””๋ ‰ํ„ฐ๋ฆฌ ๋‚ด์˜ route.ts, route.js ๋“ฑ์˜ ํŒŒ์ผ๋กœ ์ •์˜๋œ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด, app/api/users/route.ts ํŒŒ์ผ์€ /api/users ๊ฒฝ๋กœ์˜ ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ํ•ธ๋“ค๋Ÿฌ๊ฐ€ ๋œ๋‹ค.

ํ•จ์ˆ˜ ๊ธฐ๋ฐ˜์˜ HTTP ๋ฉ”์„œ๋“œ

๊ฐ HTTP ๋ฉ”์„œ๋“œ๋Š” ํŒŒ์ผ ๋‚ด์—์„œ GET, POST, PUT, DELETE์™€ ๊ฐ™์€ ์ด๋ฆ„์˜ ํ•จ์ˆ˜๋กœ ์ •์˜๋œ๋‹ค.

์ด ํ•จ์ˆ˜๋“ค์€ ์š”์ฒญ(request) ๊ฐ์ฒด๋ฅผ ์ธ์ž๋กœ ๋ฐ›๊ณ , ์‘๋‹ต(response) ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.