The node js server is not loading my website files

后端 未结 2 1027
鱼传尺愫
鱼传尺愫 2020-12-21 15:41

When I run node index.js the browser loads only the html, disregarding javascript, images, and css , and if I try to access a link it shows a blank plage: node.js Cannot GET

2条回答
  •  抹茶落季
    2020-12-21 16:35

    You need show the error with your question and "/login.html" file?

    Or quick-fix, you can change your code as below:

    res.sendFile(__dirname + '/index.html', {});
    

    to

    res.render('index.html', { /*data*/ });
    

提交回复
热议问题