In Next.js, API routes serve backend logic by acting as server-side functions that respond to HTTP requests. When a client sends a request, the API route receives it and checks the HTTP method, like GET or POST. Based on the method, it runs backend code such as fetching data or processing input. Then it sends a response back to the client, often JSON data. This flow allows backend logic to live inside the Next.js app, separate from frontend UI code. The example code shows a GET request handler that returns a JSON message. The execution table traces each step: receiving the request, checking the method, preparing the response, and sending it. Variables like req.method and res.statusCode change as the code runs. Beginners often wonder why method checking is needed and where the code runs; it runs on the server and method checking directs the logic. The visual quiz tests understanding of these steps and outcomes.