auth.ts14 lines · main
| 1 | import { Hono } from 'hono'; |
| 2 | |
| 3 | import { auth } from '../lib/auth.js'; |
| 4 | |
| 5 | /** |
| 6 | * Mount the Better Auth handler under /v1/auth/*. |
| 7 | * |
| 8 | * Better Auth owns every /v1/auth/* path (sign-up, sign-in, sign-out, magic |
| 9 | * link, OAuth callbacks, session, password reset, etc.). We never add our |
| 10 | * own routes inside this tree. |
| 11 | */ |
| 12 | export const authRouter = new Hono(); |
| 13 | |
| 14 | authRouter.on(['GET', 'POST'], '/v1/auth/*', (c) => auth.handler(c.req.raw)); |