问题描述
在使Sapper示例博客无法从数据库中获取真实数据时遇到了问题。在示例中,数据是通过js文件提供的。 我试图用自己的数据替换数据,就像在_post.js
中那样从服务器获取数据import fetch from "node-fetch";
export default (async () => {
const response = await fetch('https://www.exampleserver.de/posts?id=1309');
let json = await response.text();
//json = JSON.parse(json);
posts = json;
return posts;
})()
但是它给了我这个错误
TypeError: posts$1.map is not a function
at Object.<anonymous> (/Users/mark/01_m_code/01 SVELTE SAPPER/04 blog/__sapper__/dev/server/server.js:43:41)
我必须承认,我对工匠和苗条还很陌生,也许我对the的东西是如何工作的没有正确的了解。任何帮助表示赞赏
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)