test: validation manuelle auth middleware — 3/3 verts
This commit is contained in:
parent
f71498668f
commit
2fba6f2003
6 changed files with 281 additions and 0 deletions
21
src/routes/auth.ts
Normal file
21
src/routes/auth.ts
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue