Frontend Developer Roadmap
Step 13 / 18120 min

API

APIs & Authentication

Explanation

APIs let your frontend fetch and send data using REST or similar HTTP interfaces.

Code example

typescript
type Roadmap = {
  id: string;
  title: string;
  difficulty: "BEGINNER" | "INTERMEDIATE" | "ADVANCED";
};

export async function getRoadmaps(): Promise<Roadmap[]> {
  const response = await fetch("/api/roadmaps");
  if (!response.ok) {
    throw new Error("Failed to load roadmaps");
  }
  return response.json();
}

Exercise

Fetch a public API, show loading/error/success states, and render the results in a list.