qapinterface
Version:
Comprehensive API utilities for Node.js applications including authentication, security, request processing, and response handling with zero external dependencies
18 lines (16 loc) • 447 B
JavaScript
/**
* JSON Response Sender
* Single Responsibility: Send JSON responses with status codes
*/
/**
* Sends a JSON response with a given status code.
* @param {object} res - The Express response object.
* @param {number} statusCode - The HTTP status code.
* @param {object} data - The data to send as JSON.
*/
function sendJsonResponse(res, statusCode, data) {
res.status(statusCode).json(data);
}
module.exports = {
sendJsonResponse
};