import { All, Controller, Req, Res } from "@nestjs/common"; import { toNodeHandler } from "better-auth/node"; import { Request, Response } from "express"; import { Public } from "../common/decorators/public.decorator"; import { getAuth } from "./auth"; @Controller("auth") export class AuthController { @Public() @All("**") async handleAuth(@Req() req: Request, @Res() res: Response) { const auth = getAuth(); const handler = toNodeHandler(auth); return handler(req, res); } }