middleware composition
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
I'm using authjs middleware and I want to put some custom logic to run beside it.
is this code correct?
is this code correct?
import NextAuth from 'next-auth';
import authConfig from './auth.config';
import { NextRequest, NextResponse } from 'next/server';
export const { auth } = NextAuth(authConfig);
export const middleware = async (request: NextRequest) => {
console.log('current path', request.nextUrl.pathname);
await auth();
return NextResponse.next();
};