0

Let's say I have a node.js with Express project with the following directory:

server.js
package.json
views
   index.ejs
   css
      style.css
   js
      script.js
   video
      vid.mp4
   img
      bg.png

When I try to run this project my index.ejs shows up, but the rest of the files in the views folder don't show up. How can I fix this?

Thanks in advance!

2
  • 1
    app.use(express.static(__dirname + '/views')); Commented Aug 15, 2014 at 3:09
  • Please put that as an answer. Thanks for your help! Commented Aug 15, 2014 at 3:11

1 Answer 1

1

Use static() method in express

app.use(express.static(__dirname + '/views'));

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.