Update trpc endpoint path from '/api/trpc' to '/trpc'

This commit is contained in:
Aman Varshney
2025-04-13 11:14:51 +05:30
parent 1889dddae6
commit 6d16f276ce
5 changed files with 9 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"create-better-t-stack": patch
---
Update trpc endpoint path from '/api/trpc' to '/trpc'

View File

@@ -22,7 +22,7 @@ export const queryClient = new QueryClient({
const trpcClient = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: `${process.env.NEXT_PUBLIC_SERVER_URL}/api/trpc`,
url: `${process.env.NEXT_PUBLIC_SERVER_URL}/trpc`,
}),
],
})

View File

@@ -22,7 +22,7 @@ export const queryClient = new QueryClient({
const trpcClient = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: `${process.env.NEXT_PUBLIC_SERVER_URL}/api/trpc`,
url: `${process.env.NEXT_PUBLIC_SERVER_URL}/trpc`,
fetch(url, options) {
return fetch(url, {
...options,

View File

@@ -5,7 +5,7 @@ import { NextRequest } from 'next/server';
function handler(req: NextRequest) {
return fetchRequestHandler({
endpoint: '/api/trpc',
endpoint: '/trpc',
req,
router: appRouter,
createContext: () => createContext(req)

View File

@@ -15,5 +15,5 @@ export function middleware() {
}
export const config = {
matcher: '/api/:path*',
matcher: '/:path*',
}