找不到公共目录(404)ExpressJS和Jade
我已经使用这个服务的静态文件。
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')
这是我的结构。
这是我的控制台上的错误。
任何人都可以帮助我找出问题吗? 那将是非常赞赏。
script(src='/js/jquery.min.js')
就足够了。 您无需在url中指定public
。