Reactjs 准备请求页面盖茨比
我使用盖茨比作为前端,斯特拉皮作为后端来创建我的网站。但是,当我单击我的博客时,它只显示白色空白页面,当我在本地主机上检查时,它显示这些错误。有人经历过这个错误吗 这是我的Gatsby-node.jsReactjs 准备请求页面盖茨比,reactjs,gatsby,server-side-rendering,strapi,Reactjs,Gatsby,Server Side Rendering,Strapi,我使用盖茨比作为前端,斯特拉皮作为后端来创建我的网站。但是,当我单击我的博客时,它只显示白色空白页面,当我在本地主机上检查时,它显示这些错误。有人经历过这个错误吗 这是我的Gatsby-node.js const path = require("path") // create pages dynamically exports.createPages = async ({ graphql, actions }) => { const { createPage
const path = require("path")
// create pages dynamically
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
const result = await graphql(`
{
blogs: allStrapiBlogs {
nodes {
slug
}
}
}
`)
const prodres = await graphql(`
{
products: allStrapiProduct {
nodes {
slug
}
}
}
`)
result.data.blogs.nodes.forEach(blog => {
createPage({
path: `/blogs/${blog.slug}`,
component: path.resolve(`src/templates/blog-template.js`),
context: {
slug: blog.slug,
},
})
})
prodres.data.products.nodes.forEach(product => {
createPage({
path: `/product/${product.slug}`,
component: path.resolve(`src/templates/product-template.js`),
context: {
slug: product.slug,
},
})
})
}
你能发布任何相关的
gatsby node.js
code吗?另外,请检查您是否正确配置了设置。@Y.S.嗨,我已经用我的gatsby-node.js更新了这个问题,非常感谢您的帮助,谢谢!这些查询在graphql ide中有效吗?@Y.S.Yap,它们工作得很好无需担心,一切都很好@费兰比鲁