refactor(utils): Extract utilities from server.js
- Create src/utils/http.js - fetchT and HTTP helpers - Create src/utils/logging.js - Structured logging and error logging - Create src/utils/responses.js - Standard API responses - Create src/utils/async-handler.js - Async wrapper with error handling - Create src/utils/index.js - Consolidated exports Removes scattered helper functions from server.js
This commit is contained in:
25
dashcaddy-api/src/utils/index.js
Normal file
25
dashcaddy-api/src/utils/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Utilities index - Re-export all utility modules
|
||||
*/
|
||||
const { fetchT } = require('./http');
|
||||
const { LOG_LEVELS, createLogger, logError, safeErrorMessage } = require('./logging');
|
||||
const { errorResponse, ok } = require('./responses');
|
||||
const { asyncHandler } = require('./async-handler');
|
||||
|
||||
module.exports = {
|
||||
// HTTP
|
||||
fetchT,
|
||||
|
||||
// Logging
|
||||
LOG_LEVELS,
|
||||
createLogger,
|
||||
logError,
|
||||
safeErrorMessage,
|
||||
|
||||
// Responses
|
||||
errorResponse,
|
||||
ok,
|
||||
|
||||
// Async handling
|
||||
asyncHandler,
|
||||
};
|
||||
Reference in New Issue
Block a user