Promptabide Logo

A Prompt That Writes Express Endpoints I Actually Ship

The constraint list that turns a toy endpoint into a production one.

backend
express
typescript
api
Keywords:
express endpoint
validation
transaction
Generated endpoints are usually 80% there and missing exactly the 20% that matters in production. This constraint block closes the gap:

"Write an Express + TypeScript endpoint.

Endpoint: [method] [path]
Purpose: [one sentence]

Non-negotiables:
  • • Validate the body with express-validator; return 422 with field-level errors

  • • Auth via the existing authMiddleware; 401 if absent, 403 if the role is wrong

  • • Wrap DB work in a transaction and roll back on any throw

  • • No secrets or IDs in log lines

  • • Return the shared ResponseHelper envelope, never res.json directly

  • • Paginate any list response, default 20, max 100

  • • Handle the unique-constraint violation explicitly, not as a 500"


  • The last two are the ones I used to fix by hand on every single generated endpoint. Putting them in the prompt cut my review time roughly in half.

    Attachments (1)

    Attachment
    3.8k7
    Comments (7)
    No comments yet. Be the first to share your thoughts!
    Top Contributors
    Loading...
    Follow PromptAbide

    New bides, prompt breakdowns and community picks, on whichever feed you already read.

    Trending Tags
    Loading...
    A Prompt That Writes Express Endpoints I Actually Ship | PromptAbide