fix: add rate limiter to user/me endpoint
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/38d62fa6-b645-4f42-92dd-00d327337c17
This commit is contained in:
parent
403fc62e84
commit
18c5c82036
|
|
@ -1,10 +1,11 @@
|
|||
import { Router, Response } from 'express';
|
||||
import { authMiddleware, AuthRequest } from '../middleware/authMiddleware';
|
||||
import { rateLimiter } from '../middleware/rateLimiter';
|
||||
|
||||
const router = Router();
|
||||
|
||||
// Get current user profile
|
||||
router.get('/me', authMiddleware, (req: AuthRequest, res: Response): void => {
|
||||
router.get('/me', rateLimiter(30, 60000), authMiddleware, (req: AuthRequest, res: Response): void => {
|
||||
if (!req.user) {
|
||||
res.status(401).json({ error: true, code: 'UNAUTHORIZED', message: '未认证' });
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue