0

I am building a basic site using expressjs. All of my static assets are being loaded correctly - html, css, images, icons, fonts... all except javascript files. This is a complete mystery to me as the script tag is rendered with working href link, but console network tab is showing all files except javascript. Check screenshots:

Network Console

Script Tag

I am setting the static assets correctly and have tried multiple variations to test all deliver the same result:

app.use(express.static('public'));

I suspect it has something to do with using render instead of sendFile but I could be mistaken.

app.get('/', (req, res)=>{ res.render('index') })

Anyone have any ideas to this mystery? Thanks

1 Answer 1

1

Scripts must use src tag, not href. Change this in your script tag(s) and it should start working.

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

1 Comment

Thanks. So basic I missed it! Good eye, it's working now.

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.