带NPM模块的API调用'got'

我已经在ReactJS中设置了一个组件来调用GhostJS的API来显示post,但是我收到错误消息:

HomePage.js:30 Uncaught (in promise) TypeError: Cannot read property 'body' of undefined(…) 

以下是示例组件。 我是否应该在我自己的网站中直接引用Ghost的API或API? 他们的API的Ghost文档没有很好的解释这个部分。

除了调用他们的API,我已经尝试调用我的网站API通过replace根URL到这个输出:

 got(`http://localhost:2368/posts/${postId}`)... 

这里有什么不对吗?

在这里输入图像描述

你的promise处理是错误的。

您目前有:

 ...).then(resp, () => { ... }); 

当它应该是:

 ...).then(resp => { ... });