找不到公共目录(404)ExpressJS和Jade

时间:2016-09-09 05:57:50

标签: javascript html node.js express pug

我已使用此功能提供静态文件。

app.use(express.static(path.join(__dirname, 'public')));

这是我的index.jade示例

// jQuery
script(src='public/js/jquery.min.js')
// jQuery Easing
script(src='public/js/jquery.easing.1.3.js')
// Bootstrap
script(src='public/js/bootstrap.min.js')
// Waypoints
script(src='public/js/jquery.waypoints.min.js')
// Stellar Parallax
script(src='public/js/jquery.stellar.min.js')
// Counter
script(src='public/js/jquery.countTo.js')
// Magnific Popup
script(src='public/js/jquery.magnific-popup.min.js')
script(src='public/js/magnific-popup-options.js')
// Google Map
script(src='https://maps.googleapis.com/maps/api/js?key=AIzaSyCefOgb1ZWqYtj7raVSmN4PL2WkTrc-KyA&sensor=false')
script(src='public/js/google_map.js')
// For demo purposes only styleswitcher ( You may delete this anytime )
script(src='public/js/jquery.style.switcher.js')

这是我的结构。

enter image description here

这是我的控制台上的错误。

enter image description here

有人能帮我在这里找出问题吗?非常感谢。

1 个答案:

答案 0 :(得分:1)

script(src='/js/jquery.min.js')就足够了。您无需在网址中指定public

相关问题