Openshift: how to hide js server file in node.js application?

The JavaScript address of my server-side application is in a file called "server.js". If someone runs [app-name] .rhcloud.com / server.js in a browser, he will be able to read all the information inside the file. So how do we prevent this file from being published? It has some information that may not be publicly available, for example, a MySQL database password, etc.

+6
source share
1 answer

You can usually put static public files in a subdirectory, such as app/public , which can serve HTML, CSS, JS or otherwise. If your application code is in server.js , you will leave server.js in the application folder or something that is not specifically provided to the public. If you do not explicitly determine where the static files are served, then there is no problem if you do not have another web server such as apache serving all the app files.

+5
source

Source: https://habr.com/ru/post/974059/


All Articles