UNPKG

@nuxthub/core

Version:

Build full-stack Nuxt applications on Cloudflare, with zero configuration.

28 lines (27 loc) 907 B
import type { D1Database } from '@nuxthub/core'; /** * Access the D1 database. * * @example ```ts * const db = hubDatabase() * const result = await db.exec('SELECT * FROM table') * ``` * * @see https://hub.nuxt.com/docs/features/database */ export declare function hubDatabase(): D1Database; /** * Access the remote D1 database. * * @param projectUrl The project URL (e.g. https://my-deployed-project.nuxt.dev) * @param secretKey The secret key to authenticate to the remote endpoint * @param headers The headers to send with the request to the remote endpoint * * @example ```ts * const db = proxyHubDatabase('https://my-deployed-project.nuxt.dev', 'my-secret-key') * await db.exec('SELECT * FROM table') * ``` * * @see https://hub.nuxt.com/docs/features/database */ export declare function proxyHubDatabase(projectUrl: string, secretKey?: string, headers?: HeadersInit): D1Database;