in src/middleware/missing.js [11:36]
module.exports = function(spec) {
let defaultErrorContent;
if (spec.errorPage) {
defaultErrorContent = fs.readFileSync(spec.errorPage, "utf8");
}
return function(req, res, next) {
const config = req.superstatic;
const errorPage = config.errorPage || "/404.html";
setHeaders(spec)(
{
superstatic: config,
url: errorPage
},
res,
() => {
const handles = [{ file: errorPage, status: 404 }];
if (defaultErrorContent) {
handles.push({ data: defaultErrorContent, status: 404 });
}
res.superstatic.handle(handles, next);
}
);
};
};