I have an index.jade in my 'views' folder.
doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/main.css')
script(src='../node_modules/some_package/package_script.min.js')
I have index.js in my routes folder with a router:
router.get('/', function(req, res) {
res.render('index', { title: 'title goes here' })
});
I keep getting a 404 error when I try to access the node_modules folder in the jade file in the console:
GET /node_modules/some_package/package_script.min.js 404 1ms - 19b
How exactly does the file pathing work / how can I fix it for Express when I'm trying to access a script in the node_modules? Do I need to copy the necessary javascript files and place them under the 'javascripts' folder under 'public' for it to work?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…