1

I am trying to learn something new view engine but when I was reading the documentation on npm express-handlebars it showed directory structure like this :

. ├── app.js └── views ├── home.handlebars └── layouts └── main.handlebars

enter image description here

2 directories, 3 files

but when I am trying to implement it according to this its not working server is giving me an error :

Error: ENOENT: no such file or directory, open 'C:\Users\Admin\Documents\code\views\layouts\main.handlebars'

const app = express();
const { engine } = require("express-handlebars")

app.engine("handlebars", engine(//I know I can change thing from here));
app.set("view engine","handlebars")

app.get("/",(req,res)=>{
    res.render("home");
})

app.listen(8080)

0 Answers0