【发布时间】:2016-01-08 21:12:20
【问题描述】:
对于我的错误页面,我使用
// 500 error
app.use(function (err, req, res, next) {
console.log(err);
console.log(err.stack);
res.render("error", {
status: err.status || 500,
error: err,
title: config.pageTitles.error,
ENV: app.get('ENV')
});
});
我的错误页面是一个jade模板,看起来:
extends base
block body
body(class="gray-bg")
div(class="middle-box text-center animated fadeInDown")
h1 500
h3(class="font-bold") Internal Server Error
div(class="error-desc")
p The server encountered something unexpected that didn't allow it to complete the request. We apologize.
我的其他正常页面是
extends base
block content
#application
我的问题是当我收到 500 错误时,没有加载 CSS;但是,如果我在普通页面上加载页面error,则加载 CSS。似乎错误的app.use 导致了这种情况。
感谢帮助
【问题讨论】:
-
检查所有相对路径以确保它们指向它们应该指向的位置
标签: javascript html css node.js pug