import { type NextMiddleware, NextResponse } from "next/server" import { handleDTMC } from "@/constants/routes/dtmc" import { env } from "@/env/server" import { notFound } from "@/server/errors/next" import type { MiddlewareMatcher } from "@/types/middleware" export const middleware: NextMiddleware = (request) => { if (!env.ENABLE_DTMC) { throw notFound( `ENABLE_DTMC is disabled, returning notFound for DTMC Route: ${request.nextUrl.pathname}` ) } return NextResponse.next() } export const matcher: MiddlewareMatcher = (request) => { return handleDTMC.includes(request.nextUrl.pathname) }