提问者:小点点

如何从IGDB.com获取JSON数据? 使用Axios和nodejs


我是一个初学者程序员,我正在使用下面的代码从IGDB API中获取数据。

    axios.get('https://api-v3.igdb.com/games', {
    headers: {
        'user-key': 'my-key'
    }
   
}).then(res => console.log(res)).catch(error => console.log(error))

而不是游戏,它回应了很多东西。 我想要游戏的JSON数据。 我怎么才能拿到那个? 请帮帮我。 文件在这里。


共1个答案

匿名用户

可能使用axios响应,您需要访问data对象,如下所示

axios.get('https://api-v3.igdb.com/games', {
    headers: {
        'user-key': 'my-key'
    }
   // use res.data
}).then(res => console.log(res.data)).catch(error => console.log(error))