Rescale logoNEMO

Functions naming

Naming conventions for middleware functions

Avoid using the default middleware name or prefix/suffix for your functions. Instead, use a more descriptive name that reflects the purpose of the function. This will make your code easier to understand and maintain.

Proposal

/app/(internal)/_middleware.ts
export const internal = async ({ response }: MiddlewareFunctionProps) => { 
  // function body
  return response
}
/app/(team)/t/_middleware.ts
export const team = async ({ response }: MiddlewareFunctionProps) => { 
  // function body
  return response
}
/app/_middleware.ts
export const analytics = async ({ response }: MiddlewareFunctionProps) => { 
  // function body
  return response
}

Last updated on

On this page