fix: add better syntax for nextjs proxy

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-11-25 12:10:41 +01:00
parent 6da8267509
commit 828c8c4f91
4 changed files with 11 additions and 10 deletions

View File

@@ -278,11 +278,7 @@ With `createRouteHandler` you can proxy your events through your server, this wi
```typescript title="/app/api/[...op]/route.ts"
import { createRouteHandler } from '@openpanel/nextjs/server';
const routeHandler = createRouteHandler();
// Export the same handler for all HTTP methods - it routes internally based on pathname
export const GET = routeHandler;
export const POST = routeHandler;
export const { GET, POST } = createRouteHandler();
```
Remember to change the `apiUrl` and `cdnUrl` in the `OpenPanelComponent` to your own server.