Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit e548eb0

Browse files
committed
example: add example cms api and request in app
1 parent 3d8a4bf commit e548eb0

File tree

10 files changed

+54
-5
lines changed

10 files changed

+54
-5
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ API_TOKEN_SALT=testtoken
1212
ADMIN_JWT_SECRET=testsecret
1313
JWT_SECRET=testsecret
1414
TRANSFER_TOKEN_SALT=testtoken
15-
NODE_ENV=development
15+
NODE_ENV=development

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.env
1+
.env

app/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
node_modules
2-
.next
2+
.next

app/.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.18.2
1+
18.18.2

app/src/app/page.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import Image from 'next/image'
22

3+
// Example request to cms
4+
const cmsContentType = 'announcements'
5+
fetch(`${process.env.CMS_API}/${cmsContentType}`, {
6+
headers: {
7+
authorization: `Bearer ${process.env.CMS_TOKEN}`,
8+
},
9+
})
10+
.then((ok) => ok.json())
11+
.then((res) => console.log(res))
12+
313
export default function Home() {
414
return (
515
<main className="flex min-h-screen flex-col items-center justify-between p-24">

cms/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
node_modules
22
dist
3-
build
3+
build
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"kind": "collectionType",
3+
"collectionName": "announcements",
4+
"info": {
5+
"singularName": "announcement",
6+
"pluralName": "announcements",
7+
"displayName": "announcement"
8+
},
9+
"options": {
10+
"draftAndPublish": true
11+
},
12+
"pluginOptions": {},
13+
"attributes": {
14+
"title": {
15+
"type": "string"
16+
}
17+
}
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* announcement controller
3+
*/
4+
5+
import { factories } from '@strapi/strapi'
6+
7+
export default factories.createCoreController('api::announcement.announcement');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* announcement router
3+
*/
4+
5+
import { factories } from '@strapi/strapi';
6+
7+
export default factories.createCoreRouter('api::announcement.announcement');
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* announcement service
3+
*/
4+
5+
import { factories } from '@strapi/strapi';
6+
7+
export default factories.createCoreService('api::announcement.announcement');

0 commit comments

Comments
 (0)