Every time you check the weather, order food, or scroll through social media, APIs are working behind the scenes to make it happen.
An API (Application Programming Interface) is essentially a set of rules that lets different software applications talk to each other and share data without you ever noticing.
APIs are the backbone of modern software development. Whether you're building a simple portfolio site or working on real-world applications, you'll often need to connect to external data sources.
In this guide, you'll go from zero to a working REST API with multiple endpoints. No prior experience required.
To make this concept easier to grasp, let's use a restaurant analogy:
You don't need to know how the kitchen works β you only need to know how to ask the waiter for what you want.
APIs use HTTP methods β the same protocol your browser uses β to let applications request and send data.
Remember: GET reads, POST creates, PUT updates, DELETE removes. That's the foundation of REST APIs.
Prerequisites: Node.js installed (v18+), a code editor, and basic terminal familiarity.
Open your terminal and run:
mkdir my-first-api cd my-first-api npm init -y npm install express
Create a file called server.js and add the following code:
const express = require('express');
const app = express();
const PORT = 3000;
// Middleware to parse JSON
app.use(express.json());
// In-memory data store (simulating a database)
let users = [
{ id: 1, name: 'Alice', email: 'alice@example.com' },
{ id: 2, name: 'Bob', email: 'bob@example.com' }
];
// GET /users - Retrieve all users
app.get('/users', (req, res) => {
res.json(users);
});
// GET /users/:id - Retrieve a single user
app.get('/users/:id', (req, res) => {
const user = users.find(u => u.id === parseInt(req.params.id));
if (!user) {
return res.status(404).json({ error: 'User not found' });
}
res.json(user);
});
// POST /users - Create a new user
app.post('/users', (req, res) => {
const { name, email } = req.body;
if (!name || !email) {
return res.status(400).json({ error: 'Name and email required' });
}
const newUser = { id: users.length + 1, name, email };
users.push(newUser);
res.status(201).json(newUser);
});
// PUT /users/:id - Update a user
app.put('/users/:id', (req, res) => {
const user = users.find(u => u.id === parseInt(req.params.id));
if (!user) {
return res.status(404).json({ error: 'User not found' });
}
const { name, email } = req.body;
if (name) user.name = name;
if (email) user.email = email;
res.json(user);
});
// DELETE /users/:id - Delete a user
app.delete('/users/:id', (req, res) => {
const index = users.findIndex(u => u.id === parseInt(req.params.id));
if (index === -1) {
return res.status(404).json({ error: 'User not found' });
}
users.splice(index, 1);
res.status(204).send();
});
// Start the server
app.listen(PORT, () => {
console.log(`API running at http://localhost:${PORT}`);
});
node server.js
You should see: API running at http://localhost:3000
Use curl commands in your terminal, or use Postman.
curl http://localhost:3000/users
curl -X POST http://localhost:3000/users \
-H "Content-Type: application/json" \
-d '{"name": "Charlie", "email": "charlie@example.com"}'
curl -X PUT http://localhost:3000/users/1 \
-H "Content-Type: application/json" \
-d '{"name": "Alice Smith"}'
curl -X DELETE http://localhost:3000/users/2
π Congratulations! You now have a working REST API with full CRUD operations: GET /users, GET /users/:id, POST /users, PUT /users/:id, and DELETE /users/:id.
Following best practices makes your API easier to use and maintain.
Use nouns to represent resources. For example, use /orders instead of /create-order. HTTP methods already imply actions.
Use plural nouns for collection URIs. For example, /customers is a collection, and /customers/5 is a specific customer.
Use URL versioning like /v1/users to plan for future updates without breaking existing clients.
Learning how to fetch data from APIs is a must-have skill for any developer.
The fetch() method is a native browser feature for making HTTP requests.
import { useEffect, useState } from 'react';
function App() {
const [users, setUsers] = useState([]);
useEffect(() => {
fetch('http://localhost:3000/users')
.then(res => res.json())
.then(data => setUsers(data));
}, []);
return (
<div>
{users.map(user => (
<div key={user.id}>{user.name} β {user.email}</div>
))}
</div>
);
}
Axios simplifies HTTP requests with automatic JSON parsing and better error handling.
npm install axios
import { useEffect, useState } from 'react';
import axios from 'axios';
function App() {
const [users, setUsers] = useState([]);
useEffect(() => {
axios.get('http://localhost:3000/users')
.then(response => setUsers(response.data));
}, []);
return (
<div>
{users.map(user => (
<div key={user.id}>{user.name} β {user.email}</div>
))}
</div>
);
}
Building your first API is a major milestone in your development journey. It transforms you from someone who just uses APIs to someone who creates them.
You now understand how applications communicate, how to expose data, and how to connect frontends to backends.
The API you just built is small, but it contains the same patterns used in production applications. Master these, and you can build anything.
Now go build something awesome. π
Keywords: API, REST API, build API, API tutorial, Node.js API, Express API, CRUD, HTTP methods, API design, API for beginners, API development, Osuji Miracle, FLUXVIA
Sources: DreamFactory β’ freeCodeCamp β’ Microsoft Azure β’ Postman Blog β’ Decodo β’ Flatiron School β’ API7
Published June 19, 2026 β’ Resources β’ 10 min read β’ FLUXVIA
Most read from Fluxvia Journal β for developers, designers, and curious minds.
AI isn't replacing developers β it's upgrading them. Explore the real state of agentic software development in 2026.
Complete beginner's guide to building consistent, scalable products with atomic design methodology and real-world examples.
It's not for the computer β it's for the humans who will read, maintain, and debug it. An honest look at programming philosophy.
Step-by-step Node.js + Express tutorial with CRUD operations, testing, and React integration. No prior experience needed.
Master the 4-phase protocol and mindset shifts that separate experts from beginners. Includes GDB, Valgrind, and prevention strategies.
DeepSeek's new Vision Mode launched 15 hours ago β and it's already embarrassing itself. Here's why it can't recognize its own CEO.

"Modern web tools, guides, and resources built for developers by developers. Always free, always client-side."
Resources
Support




All Rights Reserved.
Comments
0