mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
11 lines
312 B
TypeScript
11 lines
312 B
TypeScript
import { notFound, redirect } from 'next/navigation'
|
|
import { NextRequest } from 'next/server'
|
|
|
|
export default function middleware(req: NextRequest) {
|
|
if (req.nextUrl.pathname === '/middleware/not-found') {
|
|
notFound()
|
|
} else if (req.nextUrl.pathname === '/middleware/redirect') {
|
|
redirect('/')
|
|
}
|
|
}
|