1
0

Video 48: Customizing the Views Directory

This commit is contained in:
Jason Williams 2019-09-30 11:50:05 -06:00
parent 2976413829
commit a2d9baf6e7
4 changed files with 8 additions and 1 deletions

View File

@ -2,9 +2,16 @@ const path = require('path')
const express = require('express') const express = require('express')
const app = express() const app = express()
const publicDirectoryPath = path.join(__dirname, '../public')
// Define paths for Express config
const publicDirectoryPath = path.join(__dirname, '../public')
const viewsPath = path.join(__dirname, '../templates')
// Setup handlebars engine and views location
app.set('view engine', 'hbs') app.set('view engine', 'hbs')
app.set('views', viewsPath)
// Setup static directory to serve
app.use(express.static(publicDirectoryPath)) app.use(express.static(publicDirectoryPath))
app.get('', (req, res) => { app.get('', (req, res) => {