How to convert the following code into non callbacks?

42 Views Asked by At

This is in mean-stack, angular16 JWT authentication part of code:

module.exports = function(app) {
app.use(function(req, res, next) {
res.header(
  "Access-Control-Allow-Headers",
  "Origin, Content-Type, Accept"
);
next();
});
app.get(
"/api/test/mod",
[authJwt.verifyToken, authJwt.isModerator],
controller.moderatorBoard
);

app.get(
"/api/test/admin",
[authJwt.verifyToken, authJwt.isAdmin],
controller.adminBoard
);
}

but MongooseError: Query.prototype.exec() no longer accepts a callback.

I need to convert the code without callbacks. Please help, thank you!

I just don't know how.

0

There are 0 best solutions below