I am trying to restrict the code server js files to open in browser directly. Like:
http:<<domain>>:<<port>>/<<server.js>>
If I hit this url in browser the code displays as is in js file and everyone can see the js contents and all the routing and configuration. If If I will put below code in main server js file it restrict me to use the api's for front end.
app.get('/server.js', function(req, res, next) {
res.json({
auth: false
}); });
Please help me to restrict the code to view in postman or browser.
I solved in adding below small script in main server.js(might be app.js/node.js in your file structure) file
Thank you once again nmnsud