auth.ts14 lines · main
1import { Hono } from 'hono';
2
3import { 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 */
12export const authRouter = new Hono();
13
14authRouter.on(['GET', 'POST'], '/v1/auth/*', (c) => auth.handler(c.req.raw));