mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
26 lines
523 B
TypeScript
26 lines
523 B
TypeScript
|
import db, { defineReadableTable, column } from '@astrojs/db';
|
||
|
import { defineConfig } from 'astro/config';
|
||
|
import { asJson, createGlob } from './utils';
|
||
|
|
||
|
const Quote = defineReadableTable({
|
||
|
columns: {
|
||
|
author: column.text(),
|
||
|
body: column.text(),
|
||
|
file: column.text({ unique: true }),
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export default defineConfig({
|
||
|
db: {
|
||
|
tables: { Quote },
|
||
|
data({ seed, ...ctx }) {
|
||
|
const glob = createGlob(ctx);
|
||
|
glob('quotes/*.json', {
|
||
|
into: Quote,
|
||
|
parse: asJson,
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
integrations: [db()],
|
||
|
});
|