#hi guys i have open problem how can i

1 messages · Page 1 of 1 (latest)

undone turret
#

i.e pseudo code:


export default middleware = (req) => {
  // perform logic to check if middleware1 should run and if so
  if(...){
    return withAuth(
      function middleware(req){
      },
      {
        callbacks: ...
      })(req)
  }

  // peerform logic for the second middleware
  if(...){
         return createMiddleware({
      // A list of all locales that are supported
      locales: ['en', 'de'],
     
      // If this locale is matched, pathnames work without a prefix (e.g. `/about`)
      defaultLocale: 'en'
    })(req)
  }
}

// config
export config = ....

supple salmon
#

@undone turret ohh thanks can i have 2 config?

undone turret
#

no

#

you cant

#

you need to build path matching in ur middleware

#

your best bet is to have all the paths for both middlewares all in the single config

#

and do checks in the middleware itself

#

on which middleware to run

supple salmon
#

got it