https://github.com/Akshitaag/ACM-WH I repo this in vs code and tried running it as shown The project started on server but showing error while trying to use register Error: ENOENT: no such file or directory, stat '/Users/rajivjain/Desktop/ACM-WH/C:/Users/hp/ACM-WH/public/register.html'
Help me solve this
Found the issue. If you check the "routes" directory, then take a look at where the register route is taking you, its file path is linked as this:
router.get("/register",function(req,res){
//res.sendFile("/home/rahmeen/Desktop/ACM-WH/public/register.html");
res.sendFile("C:/Users/hp/ACM-WH/public/register.html");
});
The issue with this is that it's linking to the route the file is in starting with the developer's C drive.
It seems like the developers have not yet discovered the proper usage of the path module, which is a module baked into Node; however, they are using it within the server.js.
Try replacing that entire route code referenced above with this:
const path = require('path');
router.get("/register",function(req,res){
res.sendFile(path.join(__dirname + '/register.html'));
});
I'd also recommend cleaning up the file structure of this repo.