exports.getUserBySlug = async (req, res, next) => {
const user = await User.findOne({ slug: req.params.slug })
let embed = {}
if (!user) return next();
axios.get(`https://soundcloud.com/oembed?format=json&url=${user.musicLink}`)
.then(response => {
embed = response.data
console.log('1: ', embed)
})
.catch(error => {
console.log(error);
})
console.log('2: ', embed)
res.render('user', {
user,
title: user.name,
embed: embed.html,
});
};
我是python的新手,所以请明确答案 该代码在我要创建html表的html页面中生成json响应