Back to the 2024 paper

Module I — Introduction to Web Technologies and Architectures

20247m

Discuss the concepts of client-server computing and middleware. How do they enhance the functionality of web applications?

Worked SolutionAI Assisted

Client-server computing

In client-server computing, work is split between two roles:

  • Client: the requester, usually a browser or mobile app that handles the user interface and sends requests.
  • Server: the provider, which processes requests, runs business logic, accesses the database, and returns responses.

They communicate over a network using protocols such as HTTP.

Client (browser)  --HTTP request-->  Web/App Server  -->  Database
                  <--HTTP response--

Types: thin client / fat server (most logic on the server) and fat client / thin server (most logic on the client). Modern web apps mix both, e.g. a React front end with a Node.js API.

Middleware

Middleware is software that sits between the client and the back-end systems (servers, databases, other services) and lets them communicate and work together.

Examples: application servers, web servers/reverse proxies, message queues (RabbitMQ, Kafka), API gateways, ORM and database drivers, authentication layers, Express.js middleware.

Functions: communication and protocol translation, authentication and authorization, logging, caching, load balancing, transaction management, data format conversion (JSON/XML).

How they enhance web applications

  1. Separation of concerns: UI, logic, and data are handled independently and can be changed separately.
  2. Centralised control: business rules, security, and data live on the server, so updates are made once for all users.
  3. Scalability: more servers can be added behind a load balancer; middleware distributes the load.
  4. Interoperability: middleware connects different platforms, languages, and databases.
  5. Security: sensitive data and logic stay on the server; middleware enforces authentication and validation.
  6. Reduced client requirements: thin clients work on any device with a browser.
  7. Reusability and faster development: common services (auth, logging) are written once and reused.
  8. Reliability: caching, queues, and failover keep the application responsive.

Example (Express middleware in JavaScript):

app.use(express.json());                 // parse JSON bodies
app.use((req, res, next) => {            // logging middleware
  console.log(req.method, req.url);
  next();
});
app.get('/api/users', authMiddleware, (req, res) => res.json(users));

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.