The incoming HTTP request
The DevtoolsPort instance to clear
JSON response with success status
// In a Next.js route handler:
// app/api/devtools/clear/route.ts
import { handleDevtoolsClearRequest } from "@beignet/devtools";
import { getServer } from "@/server";
export async function POST(req: Request) {
const server = await getServer();
return handleDevtoolsClearRequest(req, server.ports.devtools, {
authorize: async (request) =>
Boolean(await server.ports.auth.getSession(request)),
});
}
Handle POST requests to clear all devtools events.
This endpoint requires a POST request and will clear the in-memory event buffer.