The node js server is not loading my website files

蓝咒 提交于 2019-11-29 16:17:42

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*/ });

Here you have some code to tell your server what to when when the browser requests /.

app.get('/'

You haven't written anything to tell it what to do when the browser requests /login.html. Write something for that case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!