11import "dotenv/config"
2- import { authjsHandler , authjsSessionMiddleware } from "./server/authjs-handler"
2+ import {
3+ luciaAuthContextMiddleware ,
4+ luciaAuthCookieMiddleware ,
5+ luciaAuthLoginHandler ,
6+ luciaAuthLogoutHandler ,
7+ luciaAuthSignupHandler ,
8+ luciaCsrfMiddleware ,
9+ luciaDbMiddleware ,
10+ luciaGithubCallbackHandler ,
11+ luciaGithubLoginHandler ,
12+ } from "./server/lucia-auth-handlers"
313
414import { vikeHandler } from "./server/vike-handler"
515import { telefuncHandler } from "./server/telefunc-handler"
@@ -11,13 +21,19 @@ const app = new Hono()
1121
1222app . use ( createMiddleware ( dbMiddleware ) ( ) )
1323
14- app . use ( createMiddleware ( authjsSessionMiddleware ) ( ) )
15-
16- /**
17- * Auth.js route
18- * @link {@see https://authjs.dev/getting-started/installation }
19- **/
20- app . use ( "/api/auth/**" , createHandler ( authjsHandler ) ( ) )
24+ app . use ( createMiddleware ( luciaDbMiddleware ) ( ) )
25+ app . use ( createMiddleware ( luciaCsrfMiddleware ) ( ) )
26+ app . use ( createMiddleware ( luciaAuthContextMiddleware ) ( ) )
27+ app . use ( createMiddleware ( luciaAuthCookieMiddleware ) ( ) )
28+
29+ app . post ( "/api/signup" , createHandler ( luciaAuthSignupHandler ) ( ) )
30+ app . post ( "/api/login" , createHandler ( luciaAuthLoginHandler ) ( ) )
31+ app . post ( "/api/logout" , createHandler ( luciaAuthLogoutHandler ) ( ) )
32+ app . get ( "/api/login/github" , createHandler ( luciaGithubLoginHandler ) ( ) )
33+ app . get (
34+ "/api/login/github/callback" ,
35+ createHandler ( luciaGithubCallbackHandler ) ( )
36+ )
2137
2238app . post ( "/_telefunc" , createHandler ( telefuncHandler ) ( ) )
2339
0 commit comments