Displaying an image with EJS in node.js/express

前端 未结 3 1012
深忆病人
深忆病人 2021-02-07 05:16

I\'m just trying to get setup with node.js/express/ejs. I know ejs isn\'t actual HTML and so I\'m having a hard time just displaying a simple image. Can someone point me in the

3条回答
  •  执笔经年
    2021-02-07 05:45

    You have to assign app.use( express.static( "public" ) ); on app.js then don't forget the / as root:

    
    

    the images folder should be in public folder:

    - public/
      - images/
        - logo.png
    - app.js
    

提交回复
热议问题