๐ฝ๏ธ API๋ฅผ 5์ด ์์ด์๊ฒ ์ค๋ช ํ๋ฏ
Source: Dev.to
The Restaurant Analogy
Imagine youโre at a restaurant. You donโt walk into the kitchen to cook your own food.
You โ Waiter โ Kitchen
- You tell the waiter what you want
- The waiter goes to the kitchen
- The kitchen prepares your order
- The waiter brings it back
The waiter is the API!
In Tech Terms
Your app doesnโt talk directly to servers. It uses an API:
Your App โ API โ Server/Database
The API:
- Takes your request
- Talks to the system you canโt access directly
- Returns the data you need
Real Example
Your weather app doesnโt have weather stations. It asks:
Weather App: "Hey Weather API, what's the weather in Sydney?"
Weather API: "25ยฐC and sunny โ๏ธ"
Thatโs it. Your app gets data without knowing how it was measured.
Why It Matters
APIs let different programs talk to each other:
- Google Maps API โ Embed maps in any app
- Stripe API โ Accept payments
- Twitter API โ Show tweets on your site
You donโt rebuild Google Maps. You just ask their API.