enter image description hereI'm working on a NodeJS project, and I'm experiencing an error when trying to access the login page.
When I attempt to navigate to /login, I get the following error message:
Error: ENOENT: no such file or directory, stat 'C:\Users\Ido\Desktop\SemestrialNodeJS\public\login.html'
In the browser console, I also see this message: login:1 Failed to load resource: the server responded with a status of 404 (Not Found)
I'm not sure what's causing this issue. I checked the path and it appears correct. The login.html file is located in the public directory of my project, and I'm serving my static files using express.static('public').
I tried to implement user authentication by serving a login page (login.html) located in the 'public' directory. I'm using express.static('public') middleware to serve static files.
Based on your file structure, it looks like you're trying to access public/pages/login.html but are instead trying to access public/login.html
which doesn't exist, hence the 404 error. Try correcting your code to access the correct page.