Hey everyone.
I just deployed a Node.JS app on to my cpanel (shared hostings) but that nodejs app is a server (backend) that I can send request to different routes and get a response.
So basically a REST API app. but the problem is I don't want other people to have access to my files in the root directory
right now anyone can enter "mysite.com/package.json" or "mysite.com/server.js" and access these files (for example server.js or index.js)
So I did add password protection for that directory
But now the problem is that I can't send any request from my client app (with Javascript) and says "401 Unauthorized"
(a fetch request to my routes. for example: fetch("mysite.com/users/getname"))
What can I do ?? I don't want anyone to just type in the url and access my files but at the same time I need to send request from my client app
I just deployed a Node.JS app on to my cpanel (shared hostings) but that nodejs app is a server (backend) that I can send request to different routes and get a response.
So basically a REST API app. but the problem is I don't want other people to have access to my files in the root directory
right now anyone can enter "mysite.com/package.json" or "mysite.com/server.js" and access these files (for example server.js or index.js)
So I did add password protection for that directory
But now the problem is that I can't send any request from my client app (with Javascript) and says "401 Unauthorized"
(a fetch request to my routes. for example: fetch("mysite.com/users/getname"))
What can I do ?? I don't want anyone to just type in the url and access my files but at the same time I need to send request from my client app