What is a REST Api?

In simple terms a REST Api is an API on a backend which you make a call to from the frontend/client side, telling it what you want and it returns your data.

API Example

A very simple example is as follows: Let’s say you have a database with a bunch of product data in. You want a list of products that is cheaper than $200. You make a call to the API from the frontend. The API queries the database and returns a list of products cheaper than $200. Very simple right! You can create very complex APIs, but most of the time you’ll only need a very simple one. It’s most commonly used to query and return data from a database.

Just to summarize, the steps are:

  1. You make a call to the API telling it what you want.
  2. The API receives the call, processes or fetches the data you want.
  3. Sends the data back to you.

Building a REST API with Express.js

Just quickly before we start. What is Express.js?

Express is a backend web framework for Node.js which you can use to easily make an API

#api #nodejs #javascript #expressjs

How to Build a simple REST API with Express.js
19.75 GEEK