Skip to content

Commit e539cb5

Browse files
Add utils
1 parent 0cff98a commit e539cb5

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/utils/create-response.utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const createResponse = (statusCode: number, body: any) => {
2+
return {
3+
statusCode,
4+
body: JSON.stringify(body),
5+
};
6+
};
7+
8+
export default createResponse;

src/utils/error-messages.utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const ErrorMessages = {
2+
ITEM_ID_REQUIRED: "Item ID is required.",
3+
ITEM_NOT_FOUND: "Item not found.",
4+
INVALID_DATA: "Invalid data provided.",
5+
METHOD_NOT_ALLOWED: "Method not allowed.",
6+
};
7+
8+
export default ErrorMessages;

src/utils/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as createResponse } from "./create-response.utils";
2+
export { ErrorMessages } from "./error-messages.utils";

0 commit comments

Comments
 (0)