Json Object 属性
Json Object Property
我只想解析标题。我使用了 express、body-parse 和哈巴狗。这是我的代码:
router.get('/', async (req, res) => {
try {
const posts = await Post.find()
res.render('post', {title: posts })
}
catch (err){
res.json({errors:err})
}
})
[][1]
[1]: https://i.stack.imgur.com/1Qa1m.png
try {
let posts = await Post.find()
posts = posts.pop()
res.render('post', {title: posts['title'], description: posts['description']} )
}
我只想解析标题。我使用了 express、body-parse 和哈巴狗。这是我的代码:
router.get('/', async (req, res) => {
try {
const posts = await Post.find()
res.render('post', {title: posts })
}
catch (err){
res.json({errors:err})
}
})
[][1]
[1]: https://i.stack.imgur.com/1Qa1m.png
try {
let posts = await Post.find()
posts = posts.pop()
res.render('post', {title: posts['title'], description: posts['description']} )
}