REST stands for Representational State Transfer
A REST API is used to allow applications to communicate over HTTP 🌐
In simple words
REST API lets
frontend and backend talk to each other 🧠
Without REST APIs ❌
• Frontend cannot get data
• Backend cannot serve clients
• No real web applications
🧠 Core Principles of REST
• Client Server architecture
• Stateless requests
• Resource based URLs
• Standard HTTP methods
📦 Common HTTP Methods in REST
• GET - fetch data 👀
• POST - create data ➕
• PUT - update data ✏️
• DELETE - remove data 🗑️
🌍 Real World Examples
• Fetching posts on social media
• Logging in users
• Submitting forms
• Accessing mobile app data
🔄 How REST API Works
Client sends HTTP request 📤
Server processes logic 🧠
Server returns JSON response 📩
💻 Example: Simple REST API using Express
app.get("/users", (req, res) => {
res.json({ users: [] });
});
app.post("/users", (req, res) => {
res.send("User created");
});