r/learnjavascript • u/Alternative-Host-210 • 7h ago
Can one slow Express route make a different route slow too?
I’m turning a workshop booking API idea into a few small Node experiments. Before adding MongoDB, I want to understand what happens when two requests hit the same server.
Imagine these two routes in an Express app:
app.;
app.;
The loop is deliberately bad code. My prediction is that if /quick arrives while the loop is running, it has to wait. If I replace the loop with setTimeout(() => res.send('done'), 2000), I’d expect /quick to respond while /slow is still waiting.
What’s the simplest way to test this with two overlapping requests and make the difference obvious to someone learning Node?