Download next.js/test/development/app-dir/server-navigation-error/middleware.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 312 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/server-navigation-error/middleware.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/server-navigation-error/middleware.ts
-
curl -L -o middleware.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/server-navigation-error/middleware.ts
312 Bytes
| 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('/') | |
| } | |
| } | |