I have a NodeJS file that processes IoT data. It runs on a domain, and I have a different DOCROOT for this domain, point to /public.
Ideally I would store my main.js file outside the public folder so the javascript source code remains protected. But how would a user be able to interact with the server? Would that be to create a public/main.js, that includes the main.js file from the public parents folder. Is this correct?
So my guess is that the folder structure would be like this:
/node_modules
/public
/public/main.js
/.env
/.gitignore
/main.js
/package-lock.json
/package.json
/README.md
Is this how one would safely deploy a NodeJS server script? Or should it be done differently? I'm sorry if this is an inappropriate question, but I'm new to NodeJS and would appreciate some guidance.