Company: Quicksell_13nov
Difficulty: medium
Problem Description You are tasked with fixing a broken file-checking utility and exposing it as a REST API. The underlying function, fileExistsSync , is intended to act as a wrapper around the Node.js fs.existsSync method to check if a specific file exists on the server. Currently, the utility is broken because the file system ( fs ) module is not imported properly, and there may be issues with how the function is exported. Your goal is to fix the underlying function logic, ensure it is available to your API controller, and expose its functionality via a standard REST endpoint. Endpoints GET /api/files/exists Request Format The endpoint accepts the following query parameter: name (string, required) : The name or relative path of the file to check (e.g., sample.js , sample.txt ). Response Format On success, the endpoint must return an HTTP 200 OK with a JSON body indicating whether the file exists: { "exists": true } If the file does not exist, the endpoint should return 200 OK with "e