This repository has been archived on 2025-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
mojotrollz-app/api/middleware/isAuthenticated.ts

15 lines
306 B
TypeScript

import { Request, Response, NextFunction } from 'express'
export const isAuthenticated = function (
req: Request,
res: Response,
next: NextFunction
): any {
if (req.user === 'yo') {
return next()
}
return res.status(401).json({ message: 'unauthorized' })
}
export default isAuthenticated