Intermediate level · Module 4: Back-End Basics with Node.js and Express · Lesson 1 of 3
Clients, Servers and REST
Understand how front ends talk to back ends and design endpoints that follow REST conventions.
In this lesson you will
- Explain the client–server model
- Design RESTful endpoints with suitable methods and status codes
Key concepts
client and serverresource and endpointHTTP methodsstatus codes
The lesson
The front end runs in the user's browser; the back end runs on a server, holds the data and enforces the rules. They communicate over HTTP, usually exchanging JSON.
REST organises an API around resources: GET /api/courses lists courses, GET /api/courses/7 returns one, POST /api/enquiries creates an enquiry. Methods describe the action and paths name the resource.
Status codes tell clients what happened: 200 OK, 201 Created, 400 Bad Request for invalid input, 404 Not Found and 500 for unexpected server errors.
Step by step
- List the resources the training centre needs.
- Design endpoints with methods and paths.
- Choose status codes for success and failure cases.
- Write example JSON for each response.
Practice activity
Write the API design for the training centre system.
Expected result: A design with endpoints, methods, status codes and example JSON for each.
Check your understanding
-
Which method and path would create an enquiry?
Show answer
POST /api/enquiries.
-
What does status 201 mean?
Show answer
A resource was created.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.