Lessons 11-15 | Full-Stack Module

Create Your Own API

Build an Express.js server to receive and return data so the app can do more than display a static screen.

Lesson 1345 mincourse modulepaid enrollment

Learning objective

Create simple endpoints with clear input and output behavior.

Lab outcome

Build an API route and call it from the frontend.

Module milestone

Build a small full-stack leaderboard with persistent data.

Phase 1

Mission briefing

Before You Study (5 mins)

Lesson focus: Until now, you've been a consumer of APIs (ordering food). Today, you become the chef (making food). You will build the endpoints that your game talks to.

What you should have ready:

  • Your running server.js (Backend)
  • Postman (optional) or just your browser

Quick Concepts

TermSimple Meaning
Express.jsA framework to make building APIs easy
RouteA specific URL path (e.g., /api/scores)
EndpointThe place where the API does something
req / resRequest (what came in) / Response (what goes out)

Think About

Before studying, consider:

  1. What does your game need to send to save a score? (Name + Score).
  2. What does your game need to receive to show the leaderboard? (List of Names + Scores).

By the End

After this lesson, you'll:

  • ✅ Create a GET endpoint (to fetch scores)
  • ✅ Create a POST endpoint (to save scores)
  • ✅ Test your own API!

Order up! You're cooking now! 👨‍🍳