mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
21 lines
856 B
TypeScript
21 lines
856 B
TypeScript
import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
|
|
|
|
import { appRouterEdge } from '~/server/trpc/trpc.router-edge';
|
|
import { createTRPCFetchContext } from '~/server/trpc/trpc.server';
|
|
|
|
const handlerEdgeRoutes = (req: Request) => fetchRequestHandler({
|
|
endpoint: '/api/edge',
|
|
router: appRouterEdge,
|
|
req,
|
|
createContext: createTRPCFetchContext,
|
|
onError:
|
|
process.env.NODE_ENV === 'development'
|
|
? ({ path, error }) => console.error(`\n❌ tRPC-edge failed on ${path ?? 'unk-path'}: ${error.message}`)
|
|
: undefined,
|
|
});
|
|
|
|
// NOTE: we don't set maxDuration explicitly here - however we set it in the Vercel project settings, raising to the limit of 300s
|
|
// export const maxDuration = 60;
|
|
export const runtime = 'nodejs';
|
|
export const dynamic = 'force-dynamic';
|
|
export { handlerEdgeRoutes as GET, handlerEdgeRoutes as POST }; |