【问题标题】:Rendering 'index.html' in node js, shows blank screen在节点 js 中渲染“index.html”,显示空白屏幕
【发布时间】:2021-03-10 03:19:36
【问题描述】:

嘿,伙计们,这是我的节点 js 代码我试图通过节点 js 呈现一个 html 文件,它返回空白屏幕,无论如何我可以在标题栏中看到正在读取文件。 如何呈现一个简单的 index.html 还是 node 中的 react js 包?

router.get('/', function (req, res) {
  
  if (req.isAuthenticated())
  {
    res.sendFile(path.join(__dirname+'../../../build/index.html'));
    console.log(res)
  }

Here is the output on my screen which reads the title from my html file

【问题讨论】:

  • 显示终端显示的错误

标签: html node.js reactjs express rendering


【解决方案1】:

请检查你的html文件,可能是你的html文件本身的问题,而不是NodeJS的问题

【讨论】:

    猜你喜欢
    • 2022-10-17
    • 1970-01-01
    • 2015-09-05
    • 1970-01-01
    • 2019-12-24
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多