why i am getting a "throw err" in this app.js file?
hello guys
pls consider this code and tell me why i am getting a "throw err"
app.js file
pls helpthanks
pls consider this code and tell me why i am getting a "throw err"
app.js file
const express = require("express");
const app = express();
const jsonData = require("./jsonFile/data.json");
app.set("view engine", "ejs");
app.use(require("./routes/index"));
app.use(jsonData);
app.listen(3000, ()=>{
console.log("listening on port");
})
index.js file
const express = require("express");
const router = express.Router();
const jsonData = require("./jsonFile/data.json");
router.get("/index", (req, res)=>{
const retrieveData = jsonData.datafile;
res.render("index", {
retrieveData: retrieveData
});
});
module.exports = router;
finally the ejs file
<% retrieveData.forEach((data)=>{ %>
<h3><%= data.title %></h3>
<% }) %>I am starting to develop a basic site yet i have ran into this err early in this project.pls helpthanks
No any search results
You already invited:
2 Answers
bobkik
Upvotes from:
Adam Burnham
Upvotes from: