1
미들웨어에서 외부 세계의 일부 기능에 액세스하려면 어떻게해야합니까? 예를 들어 요청의 일부를 확인하고 locals
을 설정해야하는 경우 해당 파일의 머리에서express.js 미들웨어의 외부 함수 사용
app.use(function (req, res, next) {
if (myfunc(req)) { // <-- how should I load this function to be accessible here?
res.locals.myvar = true;
}
next();
});