Beignet API reference
    Preparing search index...

    Function handleDevtoolsRequest

    • Unified devtools request handler.

      Routes requests to the appropriate handler based on the URL path:

      • {basePath}/core/events → event list (GET)
      • {basePath}/stream → live event stream (GET)
      • {basePath}/clear → clear buffer (POST)
      • {basePath} → dashboard UI (GET)

      This lets you wire up a single catch-all route instead of three separate ones.

      Parameters

      • req: Request

        The incoming HTTP request

      • devtools: DevtoolsPort

        The DevtoolsPort instance

      • options: DevtoolsRequestOptions

        Devtools route options including base path and access policy

      Returns Promise<Response>

      Response for the matched sub-route

      // Next.js catch-all route: app/api/devtools/[[...path]]/route.ts
      import { createDevtoolsRoute } from "@beignet/devtools";
      import { getDevtools } from "@/server";

      export const { GET, POST } = createDevtoolsRoute(getDevtools(), {
      basePath: "/api/devtools",
      });