import { db } from 'hub:db'
import { kv } from 'hub:kv'
import { blob } from 'hub:blob'
const todos = await db.query.todos.findMany()
const value = await kv.get('my-key')
const file = await blob.put('my-file.txt', 'file-content')
const cachedAPICall = defineCachedFunction(async () => {
return $fetch('https://api.example.com/todos')
}, { maxAge: 60 * 60 })
import { pgTable, integer, text, boolean } from 'drizzle-orm/pg-core'
export const todos = pgTable('todos', {
id: integer().primaryKey(),
title: text().notNull(),
completed: boolean().notNull().default(false),
})
export default defineNuxtConfig({
modules: ['@nuxthub/core'],
hub: {
blob: true,
cache: true,
db: 'postgresql',
kv: true,
}
})