What Is a REST API?

A REST API is an interface that allows applications to communicate over HTTP using resources and standardized HTTP methods.

REST stands for Representational State Transfer. It is an architectural style for designing networked applications.

Imagine building an e-commerce application. You might have the following resources:

  • Users
  • Products
  • Categories
  • Orders
  • Payments

Each resource can be exposed through an API endpoint.

For example:

GET /api/products

This endpoint retrieves products from the server.

POST /api/products

This endpoint creates a new product.

PUT /api/products/123

This endpoint replaces an existing product.

DELETE /api/products/123

This endpoint deletes a product.

The frontend does not need to know how the backend stores its data. It communicates with the backend through HTTP requests and receives responses, commonly in JSON format.

Where are REST APIs used?

  • Web applications.
  • Mobile applications.
  • E-commerce platforms.
  • Authentication systems.
  • Admin dashboards.
  • Payment integrations.
  • Third-party service integrations.
  • Microservices architectures.

In this tutorial, we will build a complete User Management REST API using Node.js, Express and MongoDB.

REST API Fundamentals

Architecture

Client-server

Communication

HTTP/HTTPS

Data Format

JSON

Operations

CRUD

Backend

Node.js and Express

Database

MongoDB

Key Takeaways
  • REST APIs expose application resources through HTTP endpoints.

  • Frontend applications communicate with backend APIs through requests and responses.

  • JSON is commonly used to exchange application data.