我有要使用的把手引导页,其中包含样式表,插件和指向public/assets/..的javascript;

<link href="assets/css/my-custom-styles.css" rel="stylesheet" type="text/css">


我已经声明了静态文件

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




router.get('/register', (req, res) => {
    res.render('page-register', {title: 'Register'});
});


但是,当我加载/ register时,样式表等会寻找

localhost/:14 GET http://localhost:3000/register/assets/css/bootstrap.min.css net::ERR_ABORTED


我该怎么做才能设置得到

localhost/:14 GET http://localhost:3000/assets/css/bootstrap.min.css net::ERR_ABORTED

最佳答案

您需要/在资产之前:<link href="/assets...>

10-04 21:32
查看更多