Encyclopedia / Backend

API

A defined way for one program to ask another for data or actions.

On the web this is usually HTTP endpoints that return JSON, such as GET /api/projects or POST /api/contact. The frontend calls the API, the API talks to the database and other services, and secrets stay on the server.

const res = await fetch('/api/projects');
const projects = await res.json();

Related terms

fetch() Database Serverless function

Where it shows up in a page load

  1. Step 6: Database query. Dynamic pages often need data such as a user's projects or the latest posts, so the function queries a database and puts the results into HTML or JSON. Static sites skip this step entirely.

Watch the full request journey →

More in Backend

Code and data that run on a server instead of in the visitor's browser.

Database Authentication Environment variables & secrets Third-party services Webhook

Open in the interactive encyclopedia →