My code contains the following:
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.set("view engine", "ejs");
app.get("/", function(req, res){
var today = new Date();
var currDay = today.getDay();
var day = "";
if(currDay === 0){
day = "Sunday";
}
else if(currDay === 1){
day = "Monday";
}
else if(currDay === 2){
day = "Tuesday";
}
else if(currDay === 3){
day = "Wednesday";
}
else if(currDay === 4){
day = "Thursday";
}
res.render('list', {todayDay : day});
});
app.listen(4000, function(){
console.log("Hey, you are in port 4000");
});
While following Angela Yu's web dev course, I encountered an error:
Error: Failed to lookup view "list" in views directory "C:\Users\ASUS\Dropbox\PC\Desktop\To-do\views" at Function.render (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\application.js:597:17) at ServerResponse.render (C:\Users\ASUS\Dropbox\PC\Desktop\To-do\node_modules\express\lib\response.js:1039:7) at C:\Users\ASUS\Dropbox\PC\Desktop\To-do\app.js:33:9 ... (additional error messages displayed)
If anyone can provide assistance with this issue, it would be greatly appreciated.