Can someone tell me why this doesn't work:
app.use((req, res, next) => {              
  if (req.originalUrl === '/stripewebhook') {
         next();
   } else {
          bodyParser.json();
          bodyParser.urlencoded({
              extended: true })(req, res, next);
         }
   });
But this works!
app.use((req, res, next) => {          
  if (req.originalUrl === '/stripewebhook') {
         next();
   } else {
          bodyParser.json()(req, res, next);
          bodyParser.urlencoded({
              extended: true });
         }
   });
My original code was just the two bodyParsers middleware:
 ......
    ......
    bodyParser.json();
    bodyParser.urlencoded({
                  extended: true });
    .....
I needed to add the if statement so that the webhook endpoint is skipped but I noticed that I had to set the statements like the above working example...what I am not sure about is if the .urlencoded() ever get executed??
 
     
    