Video 50: 404 Pages
This commit is contained in:
parent
3bc267a057
commit
f6dd0c90ff
@ -46,6 +46,22 @@ app.get('/weather', (req, res) => {
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/help/*', (req, res) => {
|
||||
res.render('404', {
|
||||
errorMessage: 'Help article not found.',
|
||||
title: '404',
|
||||
name: 'Jason Williams'
|
||||
})
|
||||
})
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
res.render('404', {
|
||||
errorMessage: 'Page not found.',
|
||||
title: '404',
|
||||
name: 'Jason Williams'
|
||||
})
|
||||
})
|
||||
|
||||
app.listen(4200, () => {
|
||||
console.log('Server is up on port 4200.')
|
||||
})
|
||||
|
15
web-server/templates/views/404.hbs
Normal file
15
web-server/templates/views/404.hbs
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="/css/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{>header}}
|
||||
<p>{{errorMessage}}</p>
|
||||
{{>footer}}
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user