-2

This is the error on view whenever I try watch it

enter image description here

Here is the code :

doctype
html
    head
        title Express JS
    body
        h1 Welcome to Express JS site.
        p= name
        ul#nav.bakri
            li.lelii one
            li two
            li.peduu three
        h2 Spectacular Mountain
        img(src='image.jpg', alt='Mountain View',
        style='width:304px;height:228px;')
Jonathan Lonowski
  • 121,453
  • 34
  • 200
  • 199
asi
  • 11
  • 5
  • Please do not post images of code, post the code itself. What is the error you are getting? That the image does no appear? You probably have the wrong path to the image. Does the network tab show the image being downloaded? –  May 20 '16 at 04:19
  • here is the code : – asi May 20 '16 at 04:25
  • doctype html head title Express JS body h1 Welcome to Express JS site. p= name ul#nav.bakri li.lelii one li two li.peduu three h2 Spectacular Mountain img(src='image.jpg', alt='Mountain View', style='width:304px;height:228px;') – asi May 20 '16 at 04:26
  • 1
    Put that in your question, not a comment. –  May 20 '16 at 04:29
  • The blank box means that the image was not available at the `src` given (i.e. 404 Not Found). This isn't really an issue with Jade. It will depend on 1) how your application serves static files like `image.jpg` and 2) how the current address for the page and the address for the image relate. – Jonathan Lonowski May 20 '16 at 04:45

1 Answers1

0

You must set static path for your image.jpg folder

app.use(express.static(path.join(__dirname, 'public')));  // image.jpg in "public" folder

in template (jade or bug) set

src='/image.jpg'
KibGzr
  • 2,053
  • 14
  • 15