-1

I am currently building a small website for my school project, I have searched through stackoverflow on how to include CSS files in node.js before and I have found the solution for it. However I have come across another problem and that is to include a javascript file in node.js.

This is my image slider.

this is my image slider

0

1 Answer 1

0

Use nodejs fs module in your app.js to include public assets following is the code of app.js

var fs  = require('fs');
app.use(express.static(__dirname + '/public'));

Hope it helps

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

1 Comment

This is misleading, you do not need the fs module in order to use the express.static middleware. Also, it would be helpful to explain the merits of using express.static to solve OP's issue

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.