NextJs trpcClient and merged router. But it is returning a html doc instead of json error.
I am new trpc, I am implementing a single
in nextJs v15, app router.
When i implement trpc with api routes
I encountered an error, when change the routes to
Does anyone know how to fix this issue?
trpcClient and merged router,in nextJs v15, app router.
When i implement trpc with api routes
/api/v2/user/[user]/route.ts and utils/trpc nexbacthlink /api/v2/user. this code snippet is working fine.I encountered an error, when change the routes to
/api/v2/route.ts and utils/trpc nexbacthlink to /api/v2. the request to server /api/v2/updateUserStatus is 200 but it's returning a Not Found Page in next js instead of a json.Does anyone know how to fix this issue?
code-snippet.txt2.88KB
Solution
Oh, I see now, I fixed the issue by adding
api/v2/[trpc]/route.ts. It working now with this.