mirror of
https://github.com/sergeyyarkov/next-apollo-graphql-setup.git
synced 2026-10-11 02:09:23 +03:00
restore
This commit is contained in:
commit
c4add51ac1
6
.gitignore
vendored
6
.gitignore
vendored
@ -23,3 +23,9 @@
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
# cms
|
||||||
|
cms
|
||||||
|
>>>>>>> d845bf167260c295393e750017fc4e327e987967
|
||||||
|
|||||||
@ -68,6 +68,9 @@ export default withData(Articles)
|
|||||||
```
|
```
|
||||||
## License:
|
## License:
|
||||||
[MIT](https://github.com/sergeyyarkov/next-apollo-graphql-setup/blob/master/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)
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -10,5 +10,5 @@ services:
|
|||||||
container_name: webserver
|
container_name: webserver
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build: nginx
|
build: nginx
|
||||||
ports:
|
ports:
|
||||||
- '80:80'
|
- '80:80'
|
||||||
|
|||||||
@ -14,7 +14,5 @@ server {
|
|||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
root /usr/share/nginx/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(Articles)
|
||||||
|
=======
|
||||||
|
export default withApollo({ ssr: true })(Articles)
|
||||||
|
>>>>>>> d845bf167260c295393e750017fc4e327e987967
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user