I have a JavaScript project that includes both front-end and backend codes (NodeJS). This is my production folder:
/prod
/server
sourceCode1.js
sourceCode2.js
...
sourceCodeN.js
index.js
/client
bundle.js
ReadMe.md
license.txt
When the user hit mine /server/index.js, I call express.static(__dirname + '/../client')to serve the user files js in the folder /client. At the beginning, I have many jend files in the folder /client, but they were reduced and merged into one bundle.jswhen they are moved to prod, as you can see above. I want to add one configuration file in JSON format, which contains the configuration for both my backend and external code. But I'm not sure where and how to place it. I think that no matter where I wrote it, my code in /server/index.jscan access it without problems. But for /client/bundle.jsaccess to the configuration file, it will require another request to the server, which seems to me a bad design ...
Can someone suggest a way that solves the problem better?
PS
gulp, js bundle.js, /client gulp, js . , , , gulp , .
.
, . , , , , , - , , t gulp.