multiplehats / jaydens-stack

A modern, efficient, and feature-packed monorepo boilerplate. Uses SvelteKit, tRPC, Shadcn, Tailwind CSS and Turborepo
https://jaydens-stack-web.vercel.app
70 stars 2 forks source link

add support for Edge routes. #1

Open multiplehats opened 1 year ago

multiplehats commented 1 year ago

Edge routes are currently not supported because of SvelteKitAuth in hooks.server.ts. Because hooks.server.ts intercepts each requests, it will load the Authjs config, and in turn load Prisma.

Have solved this in other projects by copying over these functions and changing /auth/ to /api/auth/ and creating a custom +page.server.ts handle. (adopted from the SvelteKitAuth handle)

But for this template it's probably better to wait until this hardcoded path is fixed upstream and these functions allow for custom base paths so that our custom +page.server.ts "handle" can go in /src/routes/api/auth/[...authjs] next to the custom tRPC handle entrypoint (the custom tRPC is also there for that very reason, to support one-off edge routes)