Video 48: Customizing the Views Directory
This commit is contained in:
parent
2976413829
commit
a2d9baf6e7
@ -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) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user