2 middlewares?
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
hello, so i started working on a new project and this is my first time trying internationalization. so i need a middleware for it. the middleware i created is in the picture, but now i need another nextauth middleware function that runs on specific routes. how do i make two middleware functions with each one having its own matcher?
7 Replies
Shy Albatross
check the path in your middleware function and do stuff conditionally, instead of using a matcher
Cape lionOP
thank your for the response, do you have an example by any chance?
Cape lionOP
im kinda confused with the nextauth one, how do i combo these 

import createMiddleware from 'next-intl/middleware';
export default createMiddleware({
locales: ['ar', 'en', 'fr'],
defaultLocale: 'ar'
})
export const config = {
matcher: ['/', '/(ar|en|fr)/:path*']
}
export default createMiddleware({
locales: ['ar', 'en', 'fr'],
defaultLocale: 'ar'
})
export const config = {
matcher: ['/', '/(ar|en|fr)/:path*']
}
export { default } from "next-auth/middleware"
export const config = { matcher: [
"/dashboard",
"/subscriptions",
"/watchlater",
"/channel/:path*",
"/upload"
]}
export const config = { matcher: [
"/dashboard",
"/subscriptions",
"/watchlater",
"/channel/:path*",
"/upload"
]}
Siberian Flycatcher
Hey 👋
https://next-intl-docs.vercel.app/docs/routing/middleware#example-auth-js
next-intl docs have an example for how to combine them with next-authhttps://next-intl-docs.vercel.app/docs/routing/middleware#example-auth-js