Logo VelaStack

Enable API

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.

$ vela enable api
src/routes/api/server.test.ts
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);
  });
});