next-enterprise/middleware.ts
joshuasalcedo-dev f691f5d570 feat: add UI component files and navigation structure
Added various UI components and navigation elements including:
- Section cards and selection components
- Social icon SVGs with horizontal/vertical text variants
- Table, tabs, and toggle components
- Site header and sidebar components
- Tooltip and unauthorized page
- Project configuration files (tsconfig.json)
- Route handlers for health checks
- Utility and hook functions for mobile responsiveness
2025-04-03 10:31:23 +08:00

28 lines
947 B
TypeScript

import { NextRequest, NextResponse } from "next/server"
export function middleware(request: NextRequest) {
// Check if environment is production and if the app is ready
const isProd = process.env.NODE_ENV === "production"
const isReady = process.env.READY === "true"
// If in production and not ready, redirect to under-development
if (isProd && !isReady) {
return NextResponse.redirect(new URL("/under-development", request.url))
}
// Original redirect for /about paths
if (request.nextUrl.pathname.startsWith("/about")) {
return NextResponse.redirect(new URL("/home", request.url))
}
if (process.env.NODE_ENV === "development") {
// return NextResponse.redirect(new URL("/showcase", request.url))
}
return NextResponse.next()
}
export const config = {
// Match about paths and the root path to check readiness
matcher: ["/about/:path*", "/((?!under-development|api|_next/static|favicon.ico).*)"],
}