531.1 Handling requests (web server frameworks)
Learn how web servers and frameworks manage and respond to client requests on the back end.
Overview
In this topic, we explore how back-end systems handle web requests from users. Students learn how web servers receive requests from the browser and pass them to back-end frameworks, which process the request, run logic, and generate responses. This introduces students to the concept of routing, middleware, and server-side control in a web application.
Targets
In this topic, students learn to:
Explain the role of a web server in a web application
Describe how back-end frameworks process and respond to requests
Understand how routing maps URLs to specific logic
Identify the parts of a server-side response cycle
Recognise how requests are handled differently on the back end compared to the front end
Syllabus references
What is a web server?
A web server is a program that listens for incoming HTTP requests from a browser (client) and returns the correct response.
Examples of web servers:
Apache
Nginx
Gunicorn (Python)
Node.js (JavaScript)
When a user visits a webpage:
The browser sends a request to the web server
The server forwards the request to the appropriate handler or framework
The server sends back the HTML, JSON, or other data as a response
The role of a web framework
A web framework is a back-end development tool that simplifies handling requests, managing routes, and connecting to databases.
Popular frameworks include:
Flask and Django (Python)
Express (JavaScript/Node.js)
Laravel (PHP)
Ruby on Rails (Ruby)
Frameworks allow developers to define how the server should respond to different types of requests using routes and controllers.
Example (Python with Flask)
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome to the homepage!"
This example responds with a welcome message when a user visits the root URL (/
).

How routing works
Routing is how a web framework maps a specific URL (e.g. /login
) to a function that handles the request. Developers define routes for:
Pages (
/home
,/about
)Actions (
/submit
,/logout
)API endpoints (
/api/users
,/api/data
)
Routing logic determines which code is run and what response is sent.
Summary
The back end of a web application is responsible for receiving requests, running server-side logic, and returning the appropriate response. Web servers and frameworks work together to route requests, connect to resources like databases, and generate dynamic content for users.
Last updated
Was this helpful?