Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update postController.ts #1152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.