feat: add payload routes on /gestion59
This commit is contained in:
7
app/(payload)/api/[...slug]/route.ts
Normal file
7
app/(payload)/api/[...slug]/route.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
|
||||||
|
import config from '../../../../payload.config'
|
||||||
|
|
||||||
|
export const GET = REST_GET(config)
|
||||||
|
export const POST = REST_POST(config)
|
||||||
|
export const DELETE = REST_DELETE(config)
|
||||||
|
export const PATCH = REST_PATCH(config)
|
||||||
19
app/(payload)/gestion59/[[...segments]]/page.tsx
Normal file
19
app/(payload)/gestion59/[[...segments]]/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { RootPage, generatePageMetadata } from '@payloadcms/next/views'
|
||||||
|
import { importMap } from '../importMap'
|
||||||
|
|
||||||
|
type Args = {
|
||||||
|
params: Promise<{
|
||||||
|
segments: string[]
|
||||||
|
}>
|
||||||
|
searchParams: Promise<{
|
||||||
|
[key: string]: string | string[]
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
|
||||||
|
export const generateMetadata = ({ params, searchParams }: Args) =>
|
||||||
|
generatePageMetadata({ config: import('../../../../payload.config'), params, searchParams })
|
||||||
|
|
||||||
|
const Page = ({ params, searchParams }: Args) =>
|
||||||
|
RootPage({ config: import('../../../../payload.config'), importMap, params, searchParams })
|
||||||
|
|
||||||
|
export default Page
|
||||||
1
app/(payload)/importMap.ts
Normal file
1
app/(payload)/importMap.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export const importMap = {}
|
||||||
@@ -1,15 +1,23 @@
|
|||||||
import { buildConfig } from 'payload'
|
import { buildConfig } from 'payload'
|
||||||
import { postgresAdapter } from '@payloadcms/db-postgres'
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
||||||
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
||||||
|
import { Services } from './payload/collections/Services'
|
||||||
|
import { Realisations } from './payload/collections/Realisations'
|
||||||
|
import { Articles } from './payload/collections/Articles'
|
||||||
|
import { Testimonials } from './payload/collections/Testimonials'
|
||||||
|
import { FAQ } from './payload/collections/FAQ'
|
||||||
|
|
||||||
export default buildConfig({
|
export default buildConfig({
|
||||||
secret: process.env.PAYLOAD_SECRET || 'change-moi',
|
secret: process.env.PAYLOAD_SECRET || 'change-moi',
|
||||||
editor: lexicalEditor(),
|
editor: lexicalEditor(),
|
||||||
|
routes: {
|
||||||
|
admin: '/gestion59',
|
||||||
|
},
|
||||||
db: postgresAdapter({
|
db: postgresAdapter({
|
||||||
pool: {
|
pool: {
|
||||||
connectionString: process.env.DATABASE_URL,
|
connectionString: process.env.DATABASE_URL,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
collections: [],
|
collections: [Services, Realisations, Articles, Testimonials, FAQ],
|
||||||
globals: [],
|
globals: [],
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user