update gatsby-postgres-graphql boilerplate (#551)

This commit is contained in:
Karthik Venkateswaran 2018-09-27 16:13:18 +05:30 committed by Shahidh K Muhammed
parent e82eb52305
commit 0ebe82c598
7 changed files with 24 additions and 12297 deletions

View File

@ -60,3 +60,5 @@ typings/
.cache/
public
yarn-error.log
package-lock.json

View File

@ -1,6 +1,6 @@
# gatsby-postgres-graphql
Boilerplate to get started with Gatsby, Hasura GraphQL engine as CMS and postgres as database using the awesome plugin [wyze/gatsby-source-graphql](https://github.com/wyze/gatsby-source-graphql).
Boilerplate to get started with Gatsby, Hasura GraphQL engine as CMS and postgres as database using the awesome plugin [gatsby-source-graphql](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-source-graphql).
# Running the app yourself

View File

@ -1,18 +1,20 @@
const fetch = require(`node-fetch`)
const { createHttpLink } = require(`apollo-link-http`)
module.exports = {
// ...
plugins: [
{
resolve: 'gatsby-source-filesystem',
resolve: 'gatsby-source-graphql',
options: {
name: 'queries',
path: `${__dirname}/src/queries/`,
},
},
{
resolve: '@wyze/gatsby-source-graphql',
options: {
headers: {},
url: `${ process.env.HASURA_GRAPHQL_URL }`,
typeName: 'HASURA',
fieldName: 'hasura',
createLink: () =>
createHttpLink({
uri: `${ process.env.HASURA_GRAPHQL_URL }`,
headers: {},
fetch,
}),
refetchInterval: 10, // Refresh every 60 seconds for new data
},
},
]

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,11 @@
"serve": "gatsby serve"
},
"dependencies": {
"@wyze/gatsby-source-graphql": "^1.2.0",
"gatsby": "^1.9.277",
"gatsby-link": "^1.6.46",
"gatsby-source-filesystem": "^1.5.39"
"apollo-link-http": "^1.5.5",
"gatsby": "^2.0.9",
"gatsby-link": "^2.0.2",
"gatsby-source-graphql": "^2.0.2",
"react": "^16.5.2",
"react-dom": "^16.5.2"
}
}

View File

@ -4,7 +4,7 @@ import AuthorList from "../components/AuthorList"
const Index = ({ data }) => (
<div>
<h1>My Authors </h1>
<AuthorList authors={data.hasuraGraphQl.author} />
<AuthorList authors={data.hasura.author} />
</div>
)
@ -12,7 +12,7 @@ export default Index;
export const query = graphql`
query AuthorQuery {
hasuraGraphQl {
hasura {
author {
id
name

View File

@ -1,6 +0,0 @@
{
author {
id
name
}
}