Cursor
REST API Error Handler Middleware
Prompt
Act as a backend architect. Write centralized error handling middleware for an Express/Node API with typed error classes, consistent JSON error responses, logging integration, and Sentry-compatible error capture.
How to use this prompt
Copy the prompt above using the copy button
Open Cursor and start a new conversation
Paste the prompt and replace [bracketed variables] with your specifics
Look for [placeholder] text in the prompt — replace these with your specific details for best results.
Related Topics
1,433 copies292 upvotes