NodeJS + Express + Handlebars - failed to locate view “index.html”

前端 未结 1 1896
时光说笑
时光说笑 2021-02-05 11:29

I have been playing a bit with Node.js. I recently started toying with Express and have been setting up a basic app. I wanted to use Handlebars as my view templating engine, b

1条回答
  •  逝去的感伤
    2021-02-05 12:13

    By default, it will look in a folder called views from the directory the script is. If you use a different dir you must specify it.

    app.set('views', __dirname + '/views');
    

    Express should also tell you more information about where it's trying to find the view, that should help you know exactly where it's looking.

    0 讨论(0)
提交回复
热议问题