File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ module.exports = {
4242 title : 'Advanced Topics' ,
4343 collapsable : false ,
4444 children : [
45+ '/guide/nuxt' ,
4546 '/guide/adapters' ,
4647 '/guide/connection-mode' ,
4748 '/guide/custom-queries' ,
Original file line number Diff line number Diff line change 1+ # Nuxt.js / SSR Integration
2+
3+ [[ toc]]
4+
5+ Since Version 1.0.0.RC.21 there is support for SSR. You will need
6+ [ node-fetch] ( https://www.npmjs.com/package/node-fetch ) in order to make it work and you have to
7+ construct your own HttpLink instance.
8+
9+ Example store setup for nuxt.js:
10+
11+ ``` javascript{13,14,15}
12+ import Vuex from 'vuex';
13+ import VuexORM from '@vuex-orm/core';
14+ import VuexORMGraphQL from '@vuex-orm/plugin-graphql';
15+ import { HttpLink } from 'apollo-link-http';
16+ import database from './database';
17+ import fetch from 'node-fetch';
18+
19+ const options = {
20+ database,
21+ url: process.env.BACKEND_URL + '/api/v2',
22+ };
23+
24+ if (process.server) {
25+ options.link = new HttpLink({ uri: options.url, fetch });
26+ }
27+
28+ VuexORM.use(VuexORMGraphQL, options);
29+
30+
31+ export default function createStore () {
32+ const plugins = [VuexORM.install(database)];
33+ return new Vuex.Store({ plugins });
34+ }
35+ ```
You can’t perform that action at this time.
0 commit comments