zenstack/samples/next.js/app/api/model/[...path]/route.ts
Yiming Cao e919bb0199
feat(tanstack-query): new implementation of tanstack-query react hooks (#356)
* WIP

* feat: tanstack-query/react CRUD hooks implementation

* fix build

* addressing PR comments

* update

* update

* migrate tests

* update

* fix test environment

* use happy-dom instead of jsdom
2025-11-02 23:14:11 -08:00

14 lines
574 B
TypeScript

import { db } from '@/lib/db';
import { schema } from '@/zenstack/schema';
import { RPCApiHandler } from '@zenstackhq/server/api';
import { NextRequestHandler } from '@zenstackhq/server/next';
const handler = NextRequestHandler({
apiHandler: new RPCApiHandler({ schema }),
// fully open ZenStackClient is used here for demo purposes only, in a real application,
// you should use one with access policies enabled
getClient: () => db,
useAppDir: true,
});
export { handler as DELETE, handler as GET, handler as PATCH, handler as POST, handler as PUT };