i am working on a full stack web developement project and i’m stuck where localhost:3000 in my browser can’t show the before and after mentioned in the layout.ejs file, which are outside the <%- body %> code. The localhost:3000 can show what’s inside the index.ejs file which have been included in the <%- body %> code but it can’t show what’s outside <%- body ->
code inside my layout.ejs file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mybrary</title>
</head>
<body>
Before
<br>
<%- body %>
<br>
After
</body>
</html>
code inside my index.ejs file
Middle
code inside my 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)