Getting error while loading an image logo in navbar-header

Hi all,

In my landing.ejs, below code exists

<div class="navbar-header">
                                <a href='/' class="navbar-brand"><img src="images/ChakraLogo.jpg"></a>

I kept image under assets/images/ChakraLogo.jpg

mentioned this line app.use(express.static(‘assets’)); in app.js

Pls help!

Then maybe your path to the resource should be like src="./assets/images/ChakraLogo.jpg".
For using express to serve your static files take a look to their docs and read this part:
“However, the path that you provide to the express.static function is relative to the directory from where you launch your node process. If you run the express app from another directory, it’s safer to use the absolute path of the directory that you want to serve:”

Maybe this helps.

Hi Sornir,

Thanks for the reply… but I am getting as " ReferenceError: path is not defined" exception…

Hi Sornir,

Issue got fixed… Thanks much :slight_smile: