diff --git a/example/graphql/categories.json b/example/graphql/categories.json
deleted file mode 100644
index 355b297..0000000
--- a/example/graphql/categories.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "query": "query categories {\n listCategories(filter:{type:\"advertisement\"}){\n items {\n id\n url\n name\n slug\n path\n type\n level\n children {\n id\n url\n name\n slug\n path\n type\n level\n children {\n id\n url\n name\n slug\n path\n type\n level\n }\n }\n }\n }\n }",
- "operationName": "categories"
-}
diff --git a/example/graphql/index.js b/example/graphql/index.js
index 5ec7ee0..8d47168 100644
--- a/example/graphql/index.js
+++ b/example/graphql/index.js
@@ -1,3 +1,3 @@
-import * as CATEGORIES from './categories.json';
+import * as USERS from './users.json';
-export { CATEGORIES };
+export { USERS };
diff --git a/example/graphql/users.gql b/example/graphql/users.gql
new file mode 100644
index 0000000..88ba416
--- /dev/null
+++ b/example/graphql/users.gql
@@ -0,0 +1,16 @@
+query allUsers {
+ allUsers {
+ id
+ name
+ createdAt
+ email
+ comments {
+ id
+ text
+ }
+ posts {
+ id
+ title
+ }
+ }
+}
diff --git a/example/graphql/users.json b/example/graphql/users.json
new file mode 100644
index 0000000..26525f7
--- /dev/null
+++ b/example/graphql/users.json
@@ -0,0 +1,5 @@
+{
+ "query": "query allUsers {\n allUsers {\n id\n name\n createdAt\n email\n comments {\n id\n text\n }\n posts {\n id\n title\n }\n }\n }",
+ "variables": {},
+ "operationName": "allUsers"
+}
diff --git a/example/nuxt.config.js b/example/nuxt.config.js
index 10d13dd..f1a0ba6 100644
--- a/example/nuxt.config.js
+++ b/example/nuxt.config.js
@@ -1,6 +1,8 @@
import { resolve } from 'path';
import * as PACKAGE from '../package.json';
+import { USERS } from './graphql';
+
const meta = [
{
once: true,
@@ -25,6 +27,29 @@ export default {
'../lib/module'
),
],
+ apisToFile: {
+ axios: {
+ baseURL: 'https://jsonplaceholder.typicode.com',
+ },
+ requests: [
+ {
+ endpoint: '/posts',
+ field: 'posts',
+ },
+ {
+ endpoint: '/comments',
+ field: 'comments',
+ },
+ // GraphQL
+ {
+ endpoint: 'https://api.graph.cool/simple/v1/ciyz901en4j590185wkmexyex',
+ method: 'post',
+ field: 'users',
+ pathToData: 'data.allUsers',
+ body: USERS,
+ },
+ ],
+ },
srcDir: __dirname,
head: {
htmlAttrs: {
@@ -33,9 +58,6 @@ export default {
title: PACKAGE.name,
meta,
},
- render: {
- resourceHints: false,
- },
/*
* Generate
*/
diff --git a/example/pages/index.vue b/example/pages/index.vue
index 9225886..e2411e5 100644
--- a/example/pages/index.vue
+++ b/example/pages/index.vue
@@ -1,7 +1,33 @@
-
- Works!
-
+
+ NUXT Apis to file
+ Nuxt module to merge and transform API calls into a single file, during the build phase.. Like a payload extractor
+
+
+
+
+ Total number of posts preloaded:
+
+
+
+
+
+
+
+ Total number of users preloaded:
+
+
+
+
+
+
+ Total number of comments preloaded: +
++ +
+