This project consists of a collection of modules and utilities for handling various aspects of web development, including exception handling, constants, API responses, Redis operations, Axios wrapper, configuration reading, validation messages, HTTP request helpers, helper functions, middleware, and request validation.
- Provides error classes for different types of exceptions:
AuthenticationError
,UnauthorizedError
,ValidationError
,DatabaseError
,RedisError
,ThirdPartyError
, andKafkaError
.
- Exports a collection of constants from
./constants/constants.js
.
- Exports functions for sending different types of API responses:
sendResponse
,sendSuccessResponse
,sendFailureResponse
,sendUnauthorizedResponse
,sendValidationFailureResponse
, andsendServerErrorResponse
.
- Exports functions for performing Redis operations such as deleting, writing, reading, and cleanup.
- Provides an Axios wrapper for making HTTP requests.
- Exports a function
readConfig
to read configuration settings from a file.
- Exports default validation messages from
./message/validation.js
.
- Provides helper functions for making HTTP requests using various methods such as GET, POST, PATCH, PUT, and DELETE.
- Exports various helper functions like
isEmpty
,getErrorMessage
,paginateHelper
,isUnique
, andisDataExists
.
- Exports middleware functions such as
setAcceptedLanguage
,graphqlAuth
,authHandler
, andparseUserHeaders
.
- Exports a function
baseValidateResponse
for validating requests.
To use any of the functionalities provided by this project, import the required modules and utilities into your codebase using ES6 import syntax.
Example:
import { sendResponse, sendSuccessResponse } from './libs/ApiResponse.js';
// Use sendResponse and sendSuccessResponse functions
Feel free to replace the comment with your actual examples and instructions.