Sorry for posting as an issue, i wasnt sure where else to post this.
I struggled to get this data provider working with the NextJS App Router approach. I now have it working and so i thought i'd share the code in case you want to add it to your readme.
In short, i had to create a folder and file at app/api/[resource]/route.ts
And then in route.ts, i added:
`// /api/[resource]/route.ts <= catch all resource requests
import { defaultHandler } from "ra-data-simple-prisma";
import { NextResponse } from "next/server";
import prisma from "@/utils/db";
// POST request
export async function POST(req: Request) {
let reqCloned = req.clone();
const body = await req.json();
let res = await defaultHandler({ body }, reqCloned, prisma);
return NextResponse.json(res);
}`
Sorry for posting as an issue, i wasnt sure where else to post this.
I struggled to get this data provider working with the NextJS App Router approach. I now have it working and so i thought i'd share the code in case you want to add it to your readme.
In short, i had to create a folder and file at app/api/[resource]/route.ts
And then in route.ts, i added:
`// /api/[resource]/route.ts <= catch all resource requests import { defaultHandler } from "ra-data-simple-prisma"; import { NextResponse } from "next/server"; import prisma from "@/utils/db";
// POST request export async function POST(req: Request) { let reqCloned = req.clone(); const body = await req.json(); let res = await defaultHandler({ body }, reqCloned, prisma); return NextResponse.json(res); }`