The server-side javascript of my app is in a file called "server.js". If anyone runs [app-name].rhcloud.com/server.js in the browser, he will be able to read all the information inside the file. So, how do we prevent this file from being public? There are some information inside it that can't just be public, like the password of the MySQL database, etc.
Commonly you might put public
static files in a subdirectory like app/public
which might serve up HTML, CSS, JS, or otherwise. If your application code is in server.js
, you'd leave server.js
in the app folder or something that is specifically not being served to the public. If you're not explicitly defining where static files are served from, then there is no issue unless you have a different web server like apache serving all app
files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With