введите здесь описание изображения, это мое изображение запроса на публикацию в классиках, я использую как bodyparser, так и express
app.use(express.urlencoded({extended:true}));
app.post("/listings/save",async(req,res)=>{
console.log("content-type:", req.headers['content-type']);
console.log("body:", req.body);
const newls= new list(req.body.listings);
console.log(`new listing ${newls}`);
await newls.save();
console.log("data has been saved");
res.redirect("/listings");
});
console
database is connected
content-type:
body: undefined
TypeError: Cannot read properties of undefined (reading 'listings')
Подробнее здесь: https://stackoverflow.com/questions/798 ... odedformat