Expose the full PocketBase API through your SvelteKit app. Flips api.enabled in @velastack/pocketbase's handlePocketbase hook and adds a smoke test hitting /api/health to confirm the route is live. Once enabled, PocketBase's collection, auth, and admin endpoints are all reachable under /api alongside your SvelteKit routes. Pair it with enable api-keys for token-based access outside the browser session.
import { describe, expect, it } from "vitest";
describe("GET /api/health", () => {
it("should return a 200 status code", async (context) => {
const response = await context.request.get("/api/health");
expect(response.status).toBe(200);
});
});
import {
POCKETBASE_URL,
POCKETBASE_SUPERUSER_EMAIL,
POCKETBASE_SUPERUSER_PASSWORD,
} from "$env/static/private";
import { handlePocketbase } from "@velastack/pocketbase";
export const handle = handlePocketbase({
pocketbaseUrl: POCKETBASE_URL,
superuserEmail: POCKETBASE_SUPERUSER_EMAIL,
superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
api: { enabled: true },
});