Company: Accenture NIT Patna
Difficulty: medium
Problem Description A web page has a color box and three buttons (Red, Green, Blue). Clicking a button changes the background color of the box. You are building the backend for this page: an API that serves the button configuration and stores the current background color of the box. Implement the function handleRequest . It receives one HTTP request written as plain text and must return the response as plain text: a status line followed by the JSON response body. Endpoints Method Endpoint Description GET /api/buttons Returns the configuration of the three buttons. GET /api/box/color Returns the current background color of the box. PUT /api/box/color Sets the background color of the box. GET /api/buttons Always responds 200 OK with exactly this array, in this order: [ { "id": "red-button", "text": "red", "backgroundColor": "red", "textColor": "white" }, { "id": "green-button", "text": "green", "backgroundColor": "green", "textColor": "white" }, { "id": "blue-button", "text": "blue", "ba