Skip to content

Commit d5764f5

Browse files
committed
chore: apply middleware to all api routes
1 parent cf62308 commit d5764f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/backend/src/routes/api/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
import { Router } from 'express'
22

3+
import {
4+
requireAuthentication,
5+
setCurrentUserContext,
6+
} from './middleware/authentication'
37
import chatRouter from './chat'
48

59
const router = Router()
610

11+
// Apply authentication middleware to ALL API routes
12+
// This mirrors how GraphQL handles authentication via context
13+
router.use(setCurrentUserContext)
14+
router.use(requireAuthentication)
15+
716
// Mount individual API routes
817
router.use('/chat', chatRouter)
918

0 commit comments

Comments
 (0)