Start connecting nuxt and strapi
This commit is contained in:
parent
f1ff6f75ad
commit
b4eeb244bf
26
packages/cms/src/api/page/content-types/page/schema.json
Normal file
26
packages/cms/src/api/page/content-types/page/schema.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"kind": "collectionType",
|
||||||
|
"collectionName": "pages",
|
||||||
|
"info": {
|
||||||
|
"singularName": "page",
|
||||||
|
"pluralName": "pages",
|
||||||
|
"displayName": "Page"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"draftAndPublish": true
|
||||||
|
},
|
||||||
|
"pluginOptions": {},
|
||||||
|
"attributes": {
|
||||||
|
"Title": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"block": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"public": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true,
|
||||||
|
"required": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
packages/cms/src/api/page/controllers/page.ts
Normal file
7
packages/cms/src/api/page/controllers/page.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/**
|
||||||
|
* page controller
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi'
|
||||||
|
|
||||||
|
export default factories.createCoreController('api::page.page');
|
7
packages/cms/src/api/page/routes/page.ts
Normal file
7
packages/cms/src/api/page/routes/page.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/**
|
||||||
|
* page router
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi';
|
||||||
|
|
||||||
|
export default factories.createCoreRouter('api::page.page');
|
7
packages/cms/src/api/page/services/page.ts
Normal file
7
packages/cms/src/api/page/services/page.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/**
|
||||||
|
* page service
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi';
|
||||||
|
|
||||||
|
export default factories.createCoreService('api::page.page');
|
10
packages/example-site/app.tsx
Normal file
10
packages/example-site/app.tsx
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import { NuxtPage } from '#components';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
return () => (
|
||||||
|
<NuxtPage />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,5 +0,0 @@
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<NuxtWelcome />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
|
@ -2,4 +2,10 @@ import { defineNuxtConfig } from 'nuxt/config';
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
modules: ['nuxt-graphql-client'],
|
modules: ['nuxt-graphql-client'],
|
||||||
|
|
||||||
|
runtimeConfig: {
|
||||||
|
public: {
|
||||||
|
GQL_HOST: 'http://localhost:1337/graphql' // overwritten by process.env.GQL_HOST
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
2323
packages/example-site/package-lock.json
generated
2323
packages/example-site/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,13 @@
|
||||||
"nuxt": "3.0.0"
|
"nuxt": "3.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@graphql-codegen/cli": "^2.16.1",
|
||||||
|
"@schlechtenburg/core": "^0.0.0",
|
||||||
|
"@schlechtenburg/heading": "^0.0.0",
|
||||||
|
"@schlechtenburg/image": "^0.0.0",
|
||||||
|
"@schlechtenburg/layout": "^0.0.0",
|
||||||
|
"@schlechtenburg/paragraph": "^0.0.0",
|
||||||
|
"event-target-polyfill": "^0.0.3",
|
||||||
"nuxt-graphql-client": "^0.2.23"
|
"nuxt-graphql-client": "^0.2.23"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
21
packages/example-site/pages/[path].tsx
Normal file
21
packages/example-site/pages/[path].tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
import {
|
||||||
|
IBlockData,
|
||||||
|
SbMain,
|
||||||
|
} from '@schlechtenburg/core';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
const route = useRoute();
|
||||||
|
const path = route.path;
|
||||||
|
|
||||||
|
console.log(path);
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<div class="sb-main-menu">
|
||||||
|
Path {path}
|
||||||
|
{/*<SbMain block={props.block} />*/}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
19
packages/example-site/pages/index.tsx
Normal file
19
packages/example-site/pages/index.tsx
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import {
|
||||||
|
defineComponent,
|
||||||
|
PropType,
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
IBlockData,
|
||||||
|
SbMain,
|
||||||
|
} from '@schlechtenburg/core';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
setup() {
|
||||||
|
return () => (
|
||||||
|
<div class="sb-main-menu">
|
||||||
|
Homepage
|
||||||
|
{/*<SbMain block={props.block} />*/}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
7
packages/example-site/queries/page.gql
Normal file
7
packages/example-site/queries/page.gql
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
query launches($limit: Int = 5) {
|
||||||
|
launches(limit: $limit) {
|
||||||
|
id
|
||||||
|
launch_year
|
||||||
|
mission_name
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue