var app = express();
var someMiddleware = function(req, res, next){
//here i want to know for which route it's executing for eg. if i hit my app with xyz.com/xyz/123 it will hit route defined below which i want to identify in this middleware execution
};
app.get('xyz/:parameter', someMiddleware,function(req, res, next){
//some action on request
});
だから、ここで実行しながら、私は、ルートミドルウェアが正確に呼び出されているかどうかを確認したいです。
'console.log(req.url)'? –
であり、ポイントがreqの場合は、111/112またはtest/112となります。ここで、111と112はreqパラメータです。両方とも同じテスト/:testIdルートです。 –