I'm using starter project. I'm trying to add image and file uploading support. Added everything as per Keystone 6 Docs and everything seems to be fine on the BE. However when I'm trying to access those files and images on the front-end. No matter where in the built-in admin FE from Keystone or using Appolo GraphQL on my React FE. Either ways it enpty., however files are there. Added local storage to config, to store files and images like this:
storage: {
my_local_files: {
kind: 'local',
type: 'file',
generateUrl: path => `${baseUrl}/files${path}`,
serverRoute: {
path: '/files',
},
storagePath: 'public/files',
},
my_local_images: {
kind: 'local',
type: 'image',
generateUrl: path => `${baseUrl}/images${path}`,
serverRoute: {
path: '/images',
},
storagePath: 'public/images',
}
},
That's what I have in schema.ts
avatar: image({ storage: 'my_local_images' }),
someFile: file({ storage: 'my_local_files' }),
Thats what I have in admin dasboard
Thats what I have in Appolo
{
"data": {
"tournaments": [
{
"someFile": {
"filesize": 1683162,
"filename": "pg-logo--jc2T29YLD8A.psd",
"url": "http://localhost:3000/files/pg-logo--jc2T29YLD8A.psd"
},
"avatar": {
"extension": "png",
"filesize": 93885,
"height": 660,
"id": "bb4cce9b-727e-4479-825d-3f6ed245db8d",
"url": "http://localhost:3000/images/bb4cce9b-727e-4479-825d-3f6ed245db8d.png",
"width": 1584
}
},
{
"someFile": null,
"avatar": {
"extension": "png",
"filesize": 2779136,
"height": 1079,
"id": "f0ec2f0b-2b75-4945-923b-ae6ff9206143",
"url": "http://localhost:3000/images/f0ec2f0b-2b75-4945-923b-ae6ff9206143.png",
"width": 1841
}
},
{
"someFile": null,
"avatar": null
}
]
}
}
What might be the issue here? Thank you
Everything was correct about this. The only problem was the port! It has to be 4000 as for Keystone config, not 3000.