Here's our IBM i webserver stack, colour-coded for reference. I found this very useful to drill the info into my stubborn 5250 brain.
The blue tier is the client browser or mobile app firing HTTP/HTTPS at your server. It knows nothing about what's running underneath on the green machine.
The two teal tiers are the PASE world. Express.js sitting on top of Node.js, both running inside IBM i's PASE environment. This is your JavaScript/npm territory, and it's where routing, middleware, and JSON handling live.
From Node.js the stack forks into two parallel paths depending on whether you need procedural logic or data:
The dashed outer rectangle is the IBM i PASE boundary everything inside it runs on the box, so latency between Node.js and your RPG programs is effectively zero. That's one of the big wins of this architecture over a remote middleware approach.

