Skip to content

feat: add express-postgres N+1 example with slow/fast endpoints - #11

Open
TarekHassan1 wants to merge 2 commits into
Truta446:mainfrom
TarekHassan1:main
Open

feat: add express-postgres N+1 example with slow/fast endpoints#11
TarekHassan1 wants to merge 2 commits into
Truta446:mainfrom
TarekHassan1:main

Conversation

@TarekHassan1

Copy link
Copy Markdown

What this changes

Adds a runnable examples/express-postgres/ directory that demonstrates the N+1 detection library against a real Express + PostgreSQL stack. Includes docker-compose.yml, a seed script, two endpoints (/orders/slow with the N+1 bug and /orders/fast with the fix), and a README.

Why this way

The existing examples/demo.mjs uses a fake client. This gives users a real, copy-paste-runnable example with an actual database so they can see the warning fire live against real queries.

How it was verified

  • docker compose up -dnode seed.mjsnode server.mjs ran successfully locally
  • curl localhost:3000/orders/slow triggers the expected N+1 warning (10× SELECT * FROM order_items WHERE order_id = ?)
  • curl localhost:3000/orders/fast returns clean with no warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant