axiodb
Version:
The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor
23 lines (22 loc) • 802 B
TypeScript
export type ResponseBuilder = {
statusCode: number;
message: string;
data?: any;
};
/**
* Builds a standardized response object with status code, message, and optional data.
*
* @param statusCode - The HTTP status code to include in the response
* @param message - The message describing the result of the operation
* @param data - Optional data payload to include in the response
* @returns A response object with statusCode, message, and data properties
*
* @example
* // Success response with data
* buildResponse(200, "User fetched successfully", { id: 1, name: "John Doe" });
*
* @example
* // Error response without data
* buildResponse(404, "User not found");
*/
export default function buildResponse(statusCode: number, message: string, data?: any): ResponseBuilder;