import { i18nRouter } from 'next-i18n-router';
import i18nConfig from './i18nConfig';
import { NextResponse, NextRequest, NextFetchEvent } from 'next/server'

// This function can be marked `async` if using `await` inside
export function middleware(req: NextRequest, evt: NextFetchEvent) {

  // console.log(`
  // ======> 
  // ${req.url} - ${JSON.stringify(req)} - ${req.nextUrl.pathname}
  // `)

  return i18nRouter(req, i18nConfig);
}

// only applies this middleware to files in the app directory
export const config = {
  matcher: '/((?!api|static|.*\\..*|_next).*)'
};

