test: validation manuelle auth middleware — 3/3 verts

This commit is contained in:
Hermann_Kitio 2026-04-16 13:52:08 +03:00
parent f71498668f
commit 2fba6f2003
6 changed files with 281 additions and 0 deletions

21
src/routes/auth.ts Normal file
View file

@ -0,0 +1,21 @@
import { Hono } from 'hono'
import { authMiddleware } from '../middleware/auth'
import type { AppVariables } from '../middleware/auth'
const auth = new Hono<{ Variables: AppVariables }>()
auth.post('/verify-token', authMiddleware, (c) => {
const profile = c.get('profile')
return c.json(
{
id: profile.id,
email: profile.email,
plan: profile.plan,
simulations_used: profile.simulations_used,
plan_expires_at: profile.plan_expires_at,
},
200
)
})
export default auth