This commit is contained in:
Bobby Wibowo 2018-01-25 01:31:31 +07:00
parent 878bdd484d
commit 6246436aed
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -62,10 +62,11 @@ for (let page of config.pages) {
// NOTE: Uses fiery-me branch of https://github.com/BobbyWibowo/HttpErrorPages
safe.use((req, res, next) => {
const errorCodes = [400, 401, 403, 404, 500, 501, 502, 503, 520, 521, 533]
for (const e of errorCodes) {
res.status(e).sendFile(`HTTP${e}.html`, { root: '../HttpErrorPages/dist/' })
}
res.status(404).sendFile('HTTP404.html', { root: '../HttpErrorPages/dist/' })
})
safe.use((err, req, res, next) => {
console.error(err)
res.status(500).sendFile('HTTP505.html', { root: '../HttpErrorPages/dist/' })
})
safe.listen(config.port, () => console.log(`lolisafe started on port ${config.port}`))