router.post('/goods/tejia',function(req,res,next){
var gid = req.body.gid;
console.log(gid);
User.find({
gid :gid
}).then(function(goodsInfo){
console.log(goodsInfo);
// res.render('main/goods',{
// goodsInfo : goodsInfo
// })
})
})
router.get('/',function(req,res,next){
console.log(req.goodsInfo);
res.render('main/goods',{
goodsInfo : req.goodsInfo
})
})
The question is how to render the page in post or get the data found from the database. I am a newbie, please bear with me
res.json() returns the data to the front end, and the front end changes the view through DOM operations