If you want to run a reverse proxy using Nginx as your reverse proxy, you can follow along with this document to get it working fast in no time.
In the default config file you are able to remove everything from the file and add in the code below. (/etc/nginx/sites-available/default) What this code below does is it takes the port 5000 on localhost and push it to the root /. Then after that it takes port 4000 and pushes it to /app. But there is some more in there, so what line 1 under location /app does is it rewrites the url to use the domain which is ^ and adds the /app to it with any extention it uses.