Download exocore-web/server/middleware/authMiddleware.ts from ChoruYt/Exocore: direct link, hf CLI and curl.
- Browser
- Download file 439 Bytes
-
https://huggingface.co/spaces/ChoruYt/Exocore/resolve/main/exocore-web/server/middleware/authMiddleware.ts
- Command line
-
hf download hf://spaces/ChoruYt/Exocore/exocore-web/server/middleware/authMiddleware.ts
-
curl -L -o authMiddleware.ts https://huggingface.co/spaces/ChoruYt/Exocore/resolve/main/exocore-web/server/middleware/authMiddleware.ts
439 Bytes
| import { Request, Response, NextFunction } from 'express'; | |
| export const authMiddleware = (req: Request, res: Response, next: NextFunction): void => { | |
| const token = req.headers.authorization?.replace('Bearer ', '') | |
| || req.query.token as string | |
| || req.body?.token as string | undefined; | |
| if (!token) { | |
| res.status(401).json({ error: 'Unauthorized — token required' }); | |
| return; | |
| } | |
| next(); | |
| }; | |