Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions week-11/solution/src/controller/postController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,14 @@ export async function deletePost(c: Context) {
return c.json({ msg: `Internal server error: ${error}` }, 500);
}
}


// Error Handling: Centralized error handling with a handleError utility function that logs errors and returns a consistent response.

// Tag Parsing: Moved tag parsing logic into a separate parseTags function to improve readability and reusability.

// Single Prisma Client Instance: Instead of creating a new PrismaClient instance in every function, it now uses a single instance, which is more efficient.

// Code Readability: Enhanced code readability by using destructuring and more descriptive variable names.

// Response Messages: Improved response messages for clarity.