Skip to content

Let's use AI to Earn!

router direct access healthz

bulaienaofutuojiesenzhang1acb9e5ea754
diff --git a/src/app/healthz/layout.tsx b/src/app/healthz/layout.tsx
new file mode 100644
index 00000000..a14e64fc
--- /dev/null
+++ b/src/app/healthz/layout.tsx
@@ -0,0 +1,16 @@
+export const metadata = {
+ title: 'Next.js',
+ description: 'Generated by Next.js',
+}
+
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+ <html lang="en">
+ <body>{children}</body>
+ </html>
+ )
+}
diff --git a/src/app/healthz/page.tsx b/src/app/healthz/page.tsx
new file mode 100644
index 00000000..db02fc88
--- /dev/null
+++ b/src/app/healthz/page.tsx
@@ -0,0 +1,25 @@
+export default function HealthzPage() {
+ return (
+ <html>
+ <head>
+ <title>Health Check</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ </head>
+ <body style={{ margin: 0, padding: 0 }}>
+ <div style={{
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ height: '100vh',
+ fontFamily: 'Arial, sans-serif',
+ backgroundColor: '#fff'
+ }}>
+ <div style={{ textAlign: 'center' }}>
+ <h1 style={{ color: '#4CAF50', marginBottom: '20px' }}>OK</h1>
+ <p style={{ color: '#666', fontSize: '16px' }}>Service is healthy</p>
+ </div>
+ </div>
+ </body>
+ </html>
+ );
+}
diff --git a/src/middleware.ts b/src/middleware.ts
index de613d90..d379277c 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -27,6 +27,7 @@ export function middleware(req: NextRequest) {
"/sitemap-4.xml",
"/sitemap",
"/chat",
+ "/healthz",
].find((v) => req.nextUrl.pathname.includes(v!))
) {
return NextResponse.next();