Skip to main content

Documentation Index

Fetch the complete documentation index at: https://neokit.dev/llms.txt

Use this file to discover all available pages before exploring further.

Installation

npx nktool add d1

Usage

Bind your database

If you install the plugin directly through nktool, the CLI will guide you through the configuration process.

Query the database

You can use the query function everywhere you want, as long the function is being called on the server side.
src/routes/api/posts/+server.ts
import { json } from '@sveltejs/kit';
import { query } from '@neokit-dev/relational';

export async function GET() {
  const result = await query('SELECT * FROM posts');

  return json(result);
}