const middleware = requiremiddlewaremiddleware;const add_question = async question options iscorrect accestoken = try const finduser = await companyfindOne attributes fullName
To use the middleware in this code, you can add the middleware function before the add_question function in the code. Here's an example:
const {middleware} = require('../../middleware/middleware');
const add_question = async (question, options, iscorrect, accestoken) => {
try {
// Your code here
} catch (error) {
// Your code here
}
}
module.exports = {
add_question: middleware(add_question) // Apply middleware to the add_question function
};
In this example, the middleware function is imported from the middleware module and applied to the add_question function using the middleware(add_question) syntax. This will ensure that the middleware function is executed before the add_question function is called
原文地址: https://www.cveoy.top/t/topic/h2ts 著作权归作者所有。请勿转载和采集!