TypeError: Router.use() requires a middleware function but got a Object #6284
Unanswered
GlitchDetected
asked this question in
Q&A
Replies: 1 comment
-
Hi, Could you please provide a reproduce-able codebase? It would be helpful for the folks answering the question. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
TypeError: Router.use() requires a middleware function but got a Object
setReqUser.ts
import { Request, Response, NextFunction } from 'express';
import User from "../models/User";
import jwt from "jsonwebtoken";
interface DecodedToken {
id?: string;
}
export default async function setReqUser (req: Request, res: Response, next: NextFunction) {
try {
const cookies = req.cookies;
const token = cookies?.token;
} catch (error) {
console.error(error);
}
next();
};
Beta Was this translation helpful? Give feedback.
All reactions