Skip to content
Advertisement

Error: Cannot GET using Express & handlebars

I’m new to JS/Handlebars and I’m unable to display an image from my home.hbs file in VS Code. When I run the server, I get this:

Error 404

Here’s my server code:

JavaScript

My “home.hbs” code:

JavaScript

The “GET” error specifically states

Cannot GET /public/img/logo.png

That’s all the info I have, any help would be much appreciated.

Advertisement

Answer

Specify the path prefix for the static file handler. Change:

JavaScript

to

JavaScript

and additionally verify that you indeed have a file named public/img/logo.png.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement