When I include header and footer files it is showing an error
[ ][1]Error: C:Usersgajulejschallengestartingfilesejschallengeejs-challengeviewshome.ejs:6
4| <meta charset="utf-8">
5|
>> 6| <%- include('views/header'); %>
7| </head>
8| <body>
9| <h1>Home</h1>
Could not find the include file "views/header"
const express = require("express");
const app = express();
app.set('view engine', 'ejs');
app.set("views",__dirname+"/views");
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static("public"));
app.get("/",function (request,response) {
response.render("home",{homeStartingContent:homeStartingContent});
});
app.listen(3000, function() {
console.log("Server started on port 3000");
});
my app.js file
this is my HOME.EJS
<<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<%- include('views/header'); %>
</head>
<body>
<h1>Home</h1>
<p>
<%= homeStartingContent%>
</p>
</body>
<%- include('views/footer');%>
</html>
question from:
https://stackoverflow.com/questions/65951556/when-i-include-header-ejs-and-footer-ejs-in-home-ejs-file-there-is-an-include-fi 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…