57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
// Welcome to Keystone!
|
|
//
|
|
// This file is what Keystone uses as the entry-point to your headless backend
|
|
//
|
|
// Keystone imports the default export of this file, expecting a Keystone configuration object
|
|
// you can find out more at https://keystonejs.com/docs/apis/config
|
|
|
|
import { config } from '@keystone-6/core'
|
|
|
|
// to keep this file tidy, we define our schema in a different file
|
|
import { lists } from './schema'
|
|
|
|
// authentication is configured separately here too, but you might move this elsewhere
|
|
// when you write your list-level access control functions, as they typically rely on session data
|
|
import { withAuth, session } from './auth'
|
|
|
|
export default withAuth(
|
|
config({
|
|
server: {
|
|
port: 3004, // ← ставим отдельный порт
|
|
cors: { origin: ["http://localhost:3001"], credentials: true },
|
|
},
|
|
ui: {
|
|
basePath: '/admin', // путь для админки
|
|
},
|
|
db: {
|
|
// we're using sqlite for the fastest startup experience
|
|
// for more information on what database might be appropriate for you
|
|
// see https://keystonejs.com/docs/guides/choosing-a-database#title
|
|
provider: 'sqlite',
|
|
url: './keystone.db',
|
|
},
|
|
storage: {
|
|
local_images: {
|
|
kind: 'local',
|
|
type: 'image',
|
|
generateUrl: path => `/images${path}`,
|
|
serverRoute: {
|
|
path: '/images',
|
|
},
|
|
storagePath: 'public/images',
|
|
},
|
|
local_files: {
|
|
kind: 'local',
|
|
type: 'file',
|
|
generateUrl: path => `/files${path}`,
|
|
serverRoute: {
|
|
path: '/files',
|
|
},
|
|
storagePath: 'public/files',
|
|
},
|
|
},
|
|
lists,
|
|
session,
|
|
})
|
|
)
|