Home > Blockchain >  I'm experiencing a long response time in postman during use middleware
I'm experiencing a long response time in postman during use middleware

Time:11-22

Hi friends, I'm experiencing a long response time in postman when I add middleware in the routers.

enter image description here

I was tried to check the middleware, but nothing have an error and also the postman request don't reach after middleware to my router controller. please help me


here is my middleware

app.use('/api/v1/exercise',authenticationMiddleware,exerciseRoute);  

Here is my router

router.route('/').get(getAllExercise)

Here is my router controller

const getAllExercise =async (req,res) => {
          
     res.status(200).send(`Hi `)
}
 

CodePudding user response:

sorry friends, I just forget to add next() function in my last line of middleware

    const middleware = (req,res,next) =>{
  
   next()

  }

I hope it's helpful for someone like me. thankyou.

my apologies for anyone feeling wasting time on this question.

CodePudding user response:

move the middleware inside router and remove it from app.use() :

router.route('/').get(authenticationMiddleware, getAllExercise)
  • Related