1
0

Video 47: Dynamic Pages with Templating

This commit is contained in:
Jason Williams
2019-09-30 11:42:22 -06:00
parent e393438dd1
commit 2976413829
6 changed files with 237 additions and 5 deletions

View File

@@ -4,8 +4,29 @@ const express = require('express')
const app = express()
const publicDirectoryPath = path.join(__dirname, '../public')
app.set('view engine', 'hbs')
app.use(express.static(publicDirectoryPath))
app.get('', (req, res) => {
res.render('index', {
title: 'Weather App',
name: 'Jason Williams'
})
})
app.get('/about', (req, res) => {
res.render('about', {
title: 'About Me',
name: 'Jason Williams'
})
})
app.get('/help', (req, res) => {
res.render('help', {
helpText: 'This is some helpful text.'
})
})
app.get('/weather', (req, res) => {
res.send({
forecast: 'It is snowing. In September.',