From ef5014c8bb45e674d0a52af5cd78075da93410e4 Mon Sep 17 00:00:00 2001 From: Mhykol Date: Sun, 3 Nov 2024 22:42:51 -0500 Subject: Update 404 Message --- app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app.js') diff --git a/app.js b/app.js index a834f26..68ca3cf 100644 --- a/app.js +++ b/app.js @@ -105,7 +105,7 @@ class App { res.send(this.readfile.GetMain(output.get(this.path.string).meta)) } } else { - res.sendStatus(404) + res.status(404).send(this.readfile.GetMain({title: 'Page not found', description: '', keywords: ''})) } break } @@ -165,7 +165,7 @@ class App { } } } else { - res.send('Not Found') + res.send(JSON.stringify({html: this.readfile.NotFound(), css: ['main.css'], js: ['purify.js', '404.js']})) } }) }) @@ -184,7 +184,10 @@ class App { } #FileOpen(x) { x.res.set('Content-Type', x.mime) - x.data.file.on('open', () => x.data.file.pipe(x.res)).on('error', () => x.res.sendStatus(404)) + x.data.file.on('open', () => x.data.file.pipe(x.res)).on('error', () => { + x.res.set('Content-Type', mime.html) + x.res.status(404).send('File not found') + }) } #ValidateCookie(req, res, next) { const { cookies } = req -- cgit v1.2.3-70-g09d2