Elysia Integration
Integrate Better Auth with Elysia.
This integration guide is assuming you are using Elysia with bun server.
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
We need to mount the handler to Elysia endpoint.
CORS
To configure cors, you can use the cors plugin from @elysiajs/cors.
Macro
You can use macro with resolve to provide session and user information before pass to view.
This will allow you to access the user and session object in all of your routes.