css – Pug wont display pictures

css – Pug wont display pictures

Express JS does not allow to serve static files likes images, videos etc. Static files are downloaded by clients from server. However, if
we have to serve static files, we will have to enable middleware
dedicated for this purpose. To do this, first of all we will create a
folder or directory named public in our project directory then add the
following line of code in our index.js.

//use middleware to serve static files

After that it is possible to just add pictures to the public folder and refer to them in pug with:

img(src=/name.png, alt=picture)

Taken from: https://learncybers.com/static-files-in-express-js/

css – Pug wont display pictures

Leave a Reply

Your email address will not be published.