send 404 for txt file not exists

This commit is contained in:
Alexander 2023-07-29 09:36:09 +00:00
parent 244665db1c
commit c8213a4ddc
1 changed files with 9 additions and 0 deletions

View File

@ -204,6 +204,15 @@ app.get('*', function(req, res){
} else {
error = true
}
// If txt-file isn't found, give the 404
if (error) {
const back = '<a href="/"><span class="dim">&lt;&lt;</span> BACK TO COSMIC VOYAGE</a>'
const error = 'Message not found. Please try again.'
const content = back + '\n\n' + error
res.status(404)
const fullUrl = 'https://cosmic.voyage' + req.originalUrl
res.render('basic', { content: content, canonical: fullUrl})
}
})
} else {
error = true