1. What is a Server (and Why Do We Need to Talk to It?)
What is a server?
A server is just a computer on the internet that:
Stores data
Runs applications
Responds to requests from other computers (clients)
Examples of servers:
Google’s servers
YouTube’s servers
Your college portal server
A backend server you build using Spring Boot, Node.js, etc.
Why do we need to talk to a server?
Whenever you:
Open a website
Log in to an app
Fetch user data
Submit a form
Call an API
👉 Your computer is sending a request to a server
👉 The server sends back a response
This request–response cycle is the heart of the web.
2. How Do We Normally Talk to Servers?
Most people use a browser:
You → Browser → Server → Browser → You
You type a URL, the browser sends a request, and shows you the response nicely.
But programmers often need to:
Test APIs
Debug backend servers
Send custom requests
Automate calls
Work without a browser
That’s where cURL comes in.
3. What is cURL (in Very Simple Terms)
Simple definition:
cURL is a tool that lets you send requests to servers from the terminal.
Think of cURL as:
A mini-browser for programmers
A way to “talk to servers” using commands
Instead of clicking buttons, you type commands.
Conceptually:
cURL → Server → Response (shown in terminal)
4. Why Programmers Need cURL
Programmers use cURL to:
✅ Test backend APIs
✅ Check if a server is working
✅ Debug request/response issues
✅ Send data to servers
✅ Automate API calls in scripts
✅ Work without any UI
If you are learning:
Backend
APIs
DevOps
Cloud
Microservices
👉 cURL is a must-know basic tool.
5. Making Your First cURL Request (Simplest Possible)
Let’s fetch a webpage.
Command:
curl https://example.com
That’s it. No flags. No complexity.
What happens?
cURL sends a request to example.com
The server sends back HTML
cURL prints it in your terminal
You will see a bunch of HTML text.
This proves:
✅ Your terminal just talked to a server
✅ You received a response
6. Understanding Request and Response (Conceptually)
Every web interaction has two parts:
Request (from you to server)
Contains:
URL
Method (GET, POST, etc.)
Headers
Optional data
Response (from server to you)
Contains:
Status code
Headers
Data (HTML, JSON, etc.)
Simple flow diagram:
Request
You (cURL) ─────────▶ Server
Response
You (cURL) ◀───────── Server
7. Understanding the Response (Status + Data)
Let’s see the response more clearly.
Command:
curl -i https://example.com
This shows:
Status line
Headers
Body (data)
You may see something like:
HTTP/1.1 200 OK
Content-Type: text/html
...
<html>
...
</html>
Important parts:
Status Code
200 OK→ Success404 Not Found→ Resource not found500 Internal Server Error→ Server problem
Data (Body)
This is the actual content:
HTML
JSON
Text
etc.
8. Introducing GET and POST (Only the Basics)
GET — Getting data
Used to:
Fetch data
Read information
Example:
curl https://api.example.com/users
Meaning:
“Server, give me users data.”
POST — Sending data
Used to:
Send data
Create something
Submit forms
Example (conceptual):
curl -X POST https://api.example.com/users
Meaning:
“Server, I want to send data to you.”
(We keep it simple for now — data and headers come later.)
9. Using cURL to Talk to APIs
APIs are just servers that return data instead of web pages.
Instead of HTML, you get JSON.
Example:
curl https://api.github.com
You will see JSON output.
This is extremely useful for:
Testing backend endpoints
Checking API responses
Debugging server logic
10. Browser vs cURL (Conceptual Difference)
Browser:
Designed for humans
Renders HTML
Has UI
Hides technical details
cURL:
Designed for programmers
Shows raw data
No UI
Shows real request/response
This makes cURL perfect for backend development.
11. Where cURL Fits in Backend Development
In backend work, you often:
Build REST APIs
Test endpoints
Debug errors
Check server health
Typical workflow:
Build Backend → Use cURL to test → Fix bugs → Repeat
cURL becomes your first debugging tool.
12. Common Beginner Mistakes with cURL
Here are very common mistakes:
❌ Thinking cURL is only for downloading websites
❌ Getting scared by too many flags
❌ Not understanding what status codes mean
❌ Copy-pasting complex commands without understanding
❌ Not realizing cURL is just sending HTTP requests
Best approach:
👉 Start simple
👉 Focus on concepts, not flags
👉 Understand request and response first
13. Simple Mental Model (Very Important)
Always think like this:
cURL = Tool to send HTTP requests
Server = Machine that responds
Response = Status + Data
If you understand this, everything else becomes easier.
14. Summary
A server is a computer that responds to requests
Browsers and cURL both talk to servers
cURL lets programmers send requests from terminal
cURL is essential for backend and API testing
Start with simple GET requests
Focus on understanding request and response
Credits: Chatgpt
Comments
Join the discussionNo comments yet. Be the first to comment.
Assignments
In this series, I will be writing articles about all the things I learn from the cohort of ChaiAurCode platform, mentored by Hitesh Choudhary sir.