0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

wip: update from seed file to data()

This commit is contained in:
bholmesdev 2024-01-11 15:05:12 -05:00 committed by Nate Moore
parent 9e8fb5c388
commit 4633d37f8c
2 changed files with 36 additions and 16 deletions

View file

@ -1,16 +0,0 @@
import { defineConfig } from 'astro/config';
import db, { field } from '@astrojs/db';
// https://astro.build/config
export default defineConfig({
integrations: [db()],
db: {
collections: {
Author: {
fields: {
name: field.text(),
},
}
}
}
});

View file

@ -0,0 +1,36 @@
import { defineConfig } from 'astro/config';
import db, { defineCollection, field } from '@astrojs/db';
const Author = defineCollection({
fields: {
name: field.text(),
},
data() {
return [
{
name: 'Ben',
},
{
name: 'Nate',
},
{
name: 'Erika',
},
{
name: 'Bjorn',
},
{
name: 'Sarah',
},
]
}
})
// https://astro.build/config
export default defineConfig({
integrations: [db()],
db: {
collections: { Author }
}
});