feat: implement authentication middleware and routes
- Added `auth.ts` for JWT authentication middleware. - Created `auth` route to handle authentication and token verification. - Integrated authentication middleware into `media.ts` for protected routes. - Updated `main.ts` to register the new authentication route.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { Hono } from 'hono'
|
||||
import { db } from '../db/index.ts'
|
||||
import type { JwtVariables } from 'hono/jwt'
|
||||
import { authMiddleware } from '../auth.ts'
|
||||
|
||||
const media = new Hono<{ Variables: JwtVariables }>()
|
||||
|
||||
media.use('/*', authMiddleware)
|
||||
|
||||
// 获取所有媒体记录
|
||||
media.get('/list', (c) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user