Не указан движок по умолчанию и не предоставлено расширение.
в новом представлении (C:\Users\LENOVO\Desktop\adin\backend\node_modules\express\lib\view.js:61:11)
в Function.render (C:\Users\LENOVO\Desktop \adin\backend\node_modules\express\lib\application.js:587:12)
в ServerResponse.render (C:\Users\LENOVO\Desktop\adin\backend\node_modules\express\lib\response.js
в C:\Users\LENOVO\Desktop\adin\backend\src\app.js:46:25
в процессе.processTicksAndRejections (node:internal/process/task_queues:95 :5)"
app.js
const static_path =path.join(__dirname,"../public");
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(static_path));
app.get("/",(req,res)=>{
res.render("index");
});
app.get("/index",(req,res)=>{
res.render("index");
})
//create a new user in database
app.post("/index",async (req,res)=>{
try{
const indexSchema=new Index({
name: req.body.name,
password: req.body.password
});
const indexed=await indexSchema.save();
res.status(201).render("index");
}catch(error){
res.status(400).send(error);
console.log(error);
}
})
app.listen(port, ()=>{
console.log(`server is running at port no ${port}`);
})
Подробнее здесь: https://stackoverflow.com/questions/764 ... -thrown-by
Мобильная версия