SolidStart 集成

在开始之前,请确保你已配置了 Better Auth 实例。如果还没有配置,请查看安装指南

【Before you start, make sure you have a Better Auth instance configured. If you haven't done that yet, check out the installation.】

安装处理程序

【Mount the handler】

我们需要将处理程序挂载到 SolidStart 服务器。在 /routes/api/auth 文件夹中的 *auth.ts 文件里放入以下代码。

【We need to mount the handler to SolidStart server. Put the following code in your *auth.ts file inside /routes/api/auth folder.】

*auth.ts
import { auth } from "~/lib/auth";
import { toSolidStartHandler } from "better-auth/solid-start";

export const { GET, POST } = toSolidStartHandler(auth);

On this page