Я работаю над проектом «Полный веб-разработки», и я застрял там, где Localhost: 3000 в моем браузере не может показать, что до и после, упомянутое в файле Mayout.ejs, которые находятся вне кода < %- body %>. The localhost:3000 can show what's inside the index.ejs file which have been included in the code but it can't show what's outside
code inside my layout.ejs file
Mybrary
Before
After
код внутри my index.ejs file
Middle
код внутри моего server.js file
const express = require('express')
const app = express()
const expressLayouts = require('express-ejs-layouts')
const indexRouter = require('./routes/index')
app.set('view engine', 'ejs')
app.set('views', __dirname + '/views')
app.set('layouts', 'layouts/layout')
app.use(express.static('public'))
app.use('/', indexRouter)
app.use(expressLayouts)
app.listen(process.env.PORT || 3000)
Подробнее здесь: https://stackoverflow.com/questions/795 ... y-ejs-file