You want to build a Node.js HTTP server that responds with JSON data and handles errors gracefully. Which approach is best?
AUse http.createServer, set Content-Type to application/json, but do not handle errors.
BUse http.createServer, send JSON as plain text, ignore errors to keep server fast.
CUse http.createServer, set Content-Type to text/html, and send JSON string directly.
DUse http.createServer, set Content-Type to application/json, and wrap response code in try-catch.