mirror of
https://github.com/sergeyyarkov/next-apollo-graphql-setup.git
synced 2026-10-11 10:19:43 +03:00
restore
This commit is contained in:
commit
c4add51ac1
6
.gitignore
vendored
6
.gitignore
vendored
@ -23,3 +23,9 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
# cms
|
||||
cms
|
||||
>>>>>>> d845bf167260c295393e750017fc4e327e987967
|
||||
|
||||
@ -68,6 +68,9 @@ export default withData(Articles)
|
||||
```
|
||||
## License:
|
||||
[MIT](https://github.com/sergeyyarkov/next-apollo-graphql-setup/blob/master/LICENSE)
|
||||
### This is a next-strapi-mongo setup to start develop your web site. This setup uses server side rendering.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
18
apolloClient.js
Normal file
18
apolloClient.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { ApolloClient } from 'apollo-client'
|
||||
import { InMemoryCache } from 'apollo-cache-inmemory'
|
||||
import { HttpLink } from 'apollo-link-http'
|
||||
import fetch from 'isomorphic-unfetch'
|
||||
|
||||
export default function createApolloClient (initialState, ctx) {
|
||||
// The `ctx` (NextPageContext) will only be present on the server.
|
||||
// use it to extract auth headers (ctx.req) or similar.
|
||||
return new ApolloClient({
|
||||
ssrMode: Boolean(ctx),
|
||||
link: new HttpLink({
|
||||
uri: 'https://next-blog-example.herokuapp.com/graphql', // Server URL (must be absolute)
|
||||
credentials: 'same-origin', // Additional fetch() options like `credentials` or `headers`
|
||||
fetch
|
||||
}),
|
||||
cache: new InMemoryCache().restore(initialState)
|
||||
})
|
||||
}
|
||||
@ -15,6 +15,4 @@ server {
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
1113
package-lock.json
generated
1113
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -31,4 +31,8 @@ const Articles = () => {
|
||||
)
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
export default withApollo(Articles)
|
||||
=======
|
||||
export default withApollo({ ssr: true })(Articles)
|
||||
>>>>>>> d845bf167260c295393e750017fc4e327e987967
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user