mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
refactor: routes and index.js
This commit is contained in:
1 parent
59590639ee
commit
9f1008336d
10 files changed
+19
-29
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { Router } from 'express'
|
||||
import * as sessionController from '../controllers/sessionController.js'
|
||||
import { sessionRateLimit } from '../../middleware/rateLimiter.js'
|
||||
import {
|
||||
createSessionValidator,
|
||||
activeSessionValidator,
|
||||
sessionListValidator,
|
||||
sessionDetailValidator,
|
||||
} from '../validators/sessionValidator.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
router.get('/', sessionListValidator, sessionController.getSessionList)
|
||||
router.post(
|
||||
'/',
|
||||
createSessionValidator,
|
||||
sessionRateLimit,
|
||||
sessionController.createSession
|
||||
)
|
||||
router.post(
|
||||
'/active',
|
||||
activeSessionValidator,
|
||||
sessionController.getOrCreateSession
|
||||
)
|
||||
router.get('/:id', sessionDetailValidator, sessionController.getSessionById)
|
||||
|
||||
export default router
|
||||
Reference in new issue
Block a user