I've installed an enterprise application that runs primarily on Node.js for serving data. It is an appliance on a CentOS box. It has many different node.js applications running at the same time on different ports. For example, there is an admin page that runs on port 4000, a user dashboard that runs on 4200, etc. This is note-worthy because I am injecting new API endpoints into the server files to serve additional data to the user. To avoid CORS, I need to serve the data from the same port that the user is currently accessing (using JSONP is annoying and unreliable for IE).
Basically I need to find the primary server.js file (or what ever it may be named) that is serving data on port 4000. I've tried a simple text match of json/js files using grep --include=*.{js,json} -rw '/folderWhereAppRuns' -e "4000"
but that brings back way too many files to sift through. A similar search for "express()"
brings back primarily the node-module files for express dependencies.
So I found the PID of the process running on port 4000 and plugged it into pwdx
, but this just brings back the root directory of where I would expect the server file to be located. There are so many subfolders within this directory though, that it doesn't do me much good. I want to know the exact location and filename of the server file.