我希望使用导出本地函数,module.exports = { router, functionName }
但目前我正在努力这样做。我的代码如下所示 - 我想知道如何导出控制器“checkUserLoginCredentials”。
router.get('/', async function checkUserLoginCredentials(req, res) {
//Controller code handling user login
});
我希望导出控制器以在单元测试中使用,但由于控制器是一个本地函数,我不能简单地将它放入module.exports
,然后使用const { checkUserLoginCredentials } = require('path')
. 任何帮助将不胜感激,谢谢。