404 page configured

This commit is contained in:
James Tomasino 2021-06-18 16:05:37 +00:00
parent 8bfaa47442
commit 8c71328c71
1 changed files with 10 additions and 2 deletions

View File

@ -66,7 +66,7 @@ app.get('/rss.xml', async function (req, res) {
const extensionRegexp = new RegExp('\.txt', 'g')
content = content.replace(domainRegexp, 'https://cosmic.voyage/')
content = content.replace(extensionRegexp, '.html')
res.setHeader('content-type', 'text/xml');
res.setHeader('content-type', 'text/xml')
res.render('raw', { content: content })
})
@ -76,11 +76,19 @@ app.get('/atom.xml', async function (req, res) {
const extensionRegexp = new RegExp('\.txt', 'g')
content = content.replace(domainRegexp, 'https://cosmic.voyage/')
content = content.replace(extensionRegexp, '.html')
res.setHeader('content-type', 'text/xml');
res.setHeader('content-type', 'text/xml')
res.render('raw', { content: content })
})
app.use(express.static(path.join(__dirname, '/static')))
app.use(express.static('/var/gopher'))
app.get('*', function(req, res){
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)
res.render('basic', { content: content })
})
app.listen(port, () => console.log(`listening on port ${port}!`))