MCPcopy Create free account
hub / github.com/TomDoesTech/REST-API-Tutorial / requiresUser

Function requiresUser

src/middleware/requiresUser.ts:4–16  ·  view source on GitHub ↗
(
  req: Request,
  res: Response,
  next: NextFunction
)

Source from the content-addressed store, hash-verified

2import { Request, Response, NextFunction } from "express";
3
4const requiresUser = async (
5 req: Request,
6 res: Response,
7 next: NextFunction
8) => {
9 const user = get(req, "user");
10
11 if (!user) {
12 return res.sendStatus(403);
13 }
14
15 return next();
16};
17
18export default requiresUser;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected